Saturday, December 16, 2017

having trouble with django models

Hello, I am newbie to django. I was trying my hand on models. When i used the below code in models.py, "timestamp" and "updated" are not able visible on admin site. Is something wrong with the code? 

'''
from django.db import models

# Create your models here.
class RestaurantLocation(models.Model):
    name             = models.CharField(max_length=120)
    location         = models.CharField(max_length=120, null=True, blank=True)
    category         = models.CharField(max_length=120, null=True, blank=True)
    timestamp        = models.DateTimeField(auto_now=False,auto_now_add=True)
    updated          = models.DateTimeField(auto_now=True, auto_now_add=False)
    
'''

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a80a81c1-fade-42a0-b8f5-20638541a5bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment