User Tools

Site Tools


info:django

General Notes

The built-in administration interface does seem very nice; see the tutorial, and The Power of Django Admin (Even For Non-Django Projects). Also: Doing cool things in Django's Admin, Adding Views to the Django Admin.

Lists of Packages

Admin Interface

Database Migrations

As of Django 1.7, a new migrations framework (by the South author, Andrew Godwin) is built into the Django core.

Managing settings.py

REST API

Timestamping with/without auto_now/auto_now_add

There was talk of deprecating it (see comments here and e.g. bug #1056), but it's still around. Official documentation: Model field reference.

The arguments against them seem to be that they keep getting broken when Django is changed.

iPython

It's nice to automatically load your models.

http://djangosnippets.org/snippets/549/

def load_django_models():
    try:
        from django.db.models.loading import get_models
        for m in get_models():
            ip.ex("from %s import %s" % (m.__module__, m.__name__))
    except ImportError:
        print "INFO: could not find a django env"
 
...
 
def main():
    ...
    load_django_models()
This is a little improvement to the idea from sheats a few days ago.

I like it over the previous solutions

because it doesn't involve doing anything other than running ./manage.py shell inside your project directory. You don't have to create any files anywhere or remember to call anything, and ipython still works fine outside of a Django project.


Throw this code in ~/.ipython/ipy_user_conf.py (ipythonrc has apparently been deprecated).

Topics

Models

Security

Sessions

info/django.txt · Last modified: 2014-09-19 19:55 by sam