Top "Django-models" questions

For questions concerning use of the model class from the web framework Django.

django template system, calling a function inside a model

I want to call a function from my model at a template such as: class ChannelStatus(models.Model): .............................. .............................. def get_…

python django django-models django-templates
In django do models have a default timestamp field?

In django - is there a default timestamp field for all objects? That is, do I have to explicitly declare …

django django-models django-views
In a django model custom save() method, how should you identify a new object?

I want to trigger a special action in the save() method of a Django model object when I'm saving a …

django django-models
How do I reference a Django settings variable in my models.py?

This is a very beginner question. But I'm stumped. How do I reference a Django settings variable in my model.…

django django-models django-settings
Django rest framework serializing many to many field

How do I serialize a many-to-many field into list of something, and return them through rest framework? In my example …

python django django-models django-rest-framework django-serializer
Set Django IntegerField by choices=... name

When you have a model field with a choices option you tend to have some magic values associated with human …

python django django-models
How to register users in Django REST framework?

I'm coding a REST API with Django REST framework. The API will be the backend of a social mobile app. …

django python-2.7 django-models django-rest-framework
Django - No such table: main.auth_user__old

I was following the first app tutorial from the official Django docs and got this error when trying to save …

python django python-3.x django-models
Get class name of django model

I have a django model: class Book(models.Model): [..] and I want to have the model name as string: 'Book'. …

django django-models
"settings.DATABASES is improperly configured" error performing syncdb with django 1.4

I've created a simple django 1.4 project and am trying to issue syncdb to create the (postgres) db schema. I'm getting …

django django-models django-admin