Hi Anil, You have multiple problems here.
On Sat, 2006-09-30 at 03:57 +0000, anil wrote: > Hi djangoers > class Poll(models.Model): > question = models.CharField(maxlength=200) > pub_date = models.DateTimeField(default='now()','date created') > > gives me an error saying > > python manage.py syncdb > Error: Couldn't install apps, because there were errors in one or more > models: > sodahead.polls: non-keyword arg after keyword arg (models.py, line 9) This is telling you that you have a Python syntax error. All positional arguments (those that are just the values, like your "date created" string) must go before all keyword arguments (those of the form "foo = bar", like your "default = ..." argument). This is nothing special to Django, it's a Python requirement. > > Please help me out > I dont want to specify datatime.now() everytime I insert something in > the db > I want it to do this automatically by calling function in postgresql You cannot specify a default in this fashion in Django. The default argument in fields for Django is handled at the Python level and not passed onto the database. If you want to set up a model in this fashion, leave off the default argument and then modify the database table after creation to add the default value. You can even have this done semi-automatically, using the initial SQL files (see [1]). For full portability, you will want to put this in the PostgreSQL-specific initial SQL file ([2]), since NOW() is not a standard call. If you want to be fully portable, use CURRENT_TIMESTAMP instead. [1] http://www.djangoproject.com/documentation/model_api/#providing-initial-sql-data [2] http://www.djangoproject.com/documentation/model_api/#database-backend-specific-sql-data Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---