Dnia 15-09-2010 o 13:35:15 Hayko Karapetyan <hayko.karape...@gmail.com>
napisaĆ(a):
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice
after "pythonmanage.py syncdb" it shows "no fixtures found" as if i
haven't
First of all, we prefer pure plain text instead html, it sometimes makes
thing hard to read.
Code looks OK, but u must make sure that def __unicode__ is on the same
level of indent as poll, choice, votes
so correct code would be like this:
class Ufo(models.Model):
<4spaces>name = models.CharField(max_length = 128)
<4spaces>crew_count = models.IntegerField()
<4spaces>def __unicode__(self):
<4spaces><4spaces>return self.name
U can use TABs instead, or as many spaces as u need, as long as they made
blocks of code. Common practice is to set ur IDE to make 4 spaces by TAB
key
read docs what fixtures are and how to use them:
http://docs.djangoproject.com/en/1.2/howto/initial-data/#providing-initial-data-with-fixtures
No fixtures are present by default
even wrote that code...and after all in 127.0.0.1/admin it doesn't show
the
the written text it shows only the class name.....spasibo)
Post traceback, if there were any errors. Do u have admin enabled in
installed aps and urls.py?
Again, read docs
http://docs.djangoproject.com/en/1.2/ref/contrib/admin/
--
Linux user
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@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.