Thursday, October 25, 2012

Re: pub_date timezone

Hi erm
 
I put that line in and still won't work. In my models.py file I have the following:
 
from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    put_date = models.DateTimeField ('date published')
class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes =models.IntegerField()
 
After I entered import Poll the following would not run
python manage.py shell
When I removed it as seen above, the shell ran but the timezone issue still existed.
 
Thanks again for your help
 
Thanks for this advice. I did import
On Thursday, October 25, 2012 1:36:39 PM UTC+1, Brendan Carroll wrote:
Hi all
I am new to Django and I'm having an issue with some code. I am trying to get through the first tutorial from the Django site.
I have a file called polls/models.py and have created a class that contains the following code
class Poll(models.Model):
     question = models.CharField(max_length=200)
     pub_date = models.DateTimeField('date published')
 
The problem occurs when I go into the command prompt and enter the following line
p = Poll(question = "Whats new? ", pub_date=timezone.now())
The error is as follows: name Poll is not defined.
Appreciate any help guidance
 
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/vqONpt4ZL6cJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment