andrewgilbertson.com - Andrew Gilbertson « Random Interests

Example domain paragraphs

It took me a while to get Ajax calls working with Angular and Django REST. This is what finally got it done.

from rest_framework import serializers from managedb.models import DatabaseConnection class DatabaseConnectionSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = DatabaseConnection # Optional to include certain fields # Here we are not returning the password field so it should never be exposed fields = ('id', 'name', 'hostname', 'port', 'username', 'schemaname') Troubleshooting – Force CSRF Cookie A final note on CSRF Cookies when going live. When I first pushed the project live I encoun

from django.views.decorators.csrf import ensure_csrf_cookie @ensure_csrf_cookie def runcustomquery(request): # view function body... Posted in Python , Web Design . How to Debug Django Posted on March 28, 2014 by Andrew Django has some very useful error pages built in that can help with a lot of debugging. Unfortunately sometimes you need to dig into the code a little more at run time to track down errors, etc.