On Thu, Mar 26, 2009 at 1:02 AM, mark <markki...@gmail.com> wrote: > > so its not possible to model this in django? > >> created timestamp without time zone DEFAULT now(), >> number_polls integer DEFAULT 0,
Depends on exactly what you are trying to achieve. Django doesn't support database-level defaults - Django's defaults are all at the ORM level. The following model definition is the Django equivalent of what you have: from datetime import datetime from django.db import models class MyModel(models.Model): created = models.DateTimeField(default=datetime.now) number_polls = models.IntegerField(default=0) This should result in compatible SQL - i.e., you should be able to use the Django ORM to access the data in your existing table. However, the defaults will be applied at the level of the ORM, not the database. (i.e., no insert coming from Django will ever cause the database default to be used). Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---