Quickstart¶
Candy provides an API quite similar to that of Django admin’s.
Note
As of version 0.7.2, django-candy
is not a drop-in replacement for
Django admin. See Differences from Django admin for more.
Register your models¶
# admin.py
from django_candy import admin
from myapp.models import MyModel
admin.site.register(MyModel)
If you reload the Candy admin site, you should find your model appear in the side menu.
ModelAdmin
class¶
Candy also provides a ModelAdmin
class similar to that of Django admin.
To choose which fields to display in the list page, you can do this:
# admin.py
from django_candy import admin
from myapp.models import MyModel
class MyModel(admin.ModelAdmin):
list_display = ['field_1', 'field_2', 'etc']
admin.site.register(MyModel, MyModelAdmin)
As of version 0.7.2, only the list page works (and partially so).
Next steps¶
As mentioned earlier, django-candy
is not a drop-in replacement for Django’s
default admin. It’s a good idea to familiarise yourself with the
differences in the API before diving deeper.