Re: Model Error
Hi Legg,
In your TextFile class, the name of your __unicode__ method is wrong. You wrote def __unicde__(self): instead of def __unicode__(self):.
I think that's the issue.
2013/6/19 Nigel Legg <nigel.legg@gmail.com>
--Many thanks.I am a bit lost as to where the error is, can anyone help?In the admin interface, I have a list of two "TextFile objects" (see image), if I edit them I can see the details.... when there are two files added.[<TextFile: TextFile object>, <TextFile: TextFile object>]>>> TextFile.object.all()>>> from apilink.models import TextFileI have been working through the tutorial, "Writing your first Django app, part 1", at https://docs.djangoproject.com/en/1.5/intro/tutorial01/. I have the following model code:However in the shell I am still getting:
from django.db import models
import datetime
from django.utils import timezone
class TextFile(models.Model):
tfile = models.CharField(max_length = 50)
filetype = models.CharField(max_length = 50)
up_date = models.DateTimeField('date_uploaded')
def __unicde__(self):
return self.tfile
def was_uploaded_recently(self):
return self.up_date>= timezone.now() - datetme.timedelta(days=1)
class Bitext_upd(models.Model):
tFile = models.ForeignKey(TextFile)
bitext_file = models.CharField(max_length = 50)
Bit_up_date = models.DateTimeField('date_analysed')
def __unicode__(self):
return self.bitext_file
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home