I 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:
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
However in the shell I am still getting:
>>> from apilink.models import TextFile
>>> TextFile.object.all()
[<TextFile: TextFile object>, <TextFile: TextFile object>]
... when there are two files added.
In the admin interface, I have a list of two "TextFile objects" (see
image), if I edit them I can see the details.
I am a bit lost as to where the error is, can anyone help?
Many thanks.
Regards,
Nigel Legg
07914 740972
http://twitter.com/nigellegg
http://uk.linkedin.com/in/nigellegg
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.