On Apr 19, 9:03 am, "Ryan Alexander" <[EMAIL PROTECTED]> wrote:
> Here's the code at the top of my models.py file:
[snip]
> def __str__(self):
> if self.day is None:
> return 'undefined'
> else:
> return WEEKDAY_CHOICES[int(self.day)][1]
There's an easier (django) way to do this:
def __str__(self):
return self.day.get_day_display()
This will return the second value of the tuple, "Sunday" if it were
"6".
The DB api documents get_FOO_display() here:
http://www.djangoproject.com/documentation/db_api/#get-foo-display
> class Meta:
> ordering = ("day",)
>
> yet when I do the:
>
> python manage.py test
>
> command, it says Ran 0 tests in 0.000s
>
> Is there something I didn't set up properly? I followed the
> instructions on the django site?!
I'm not entirely sure, as I've only used unittest at this point, but I
think you have to call the doctest.test_mod() in your models.py, or in
tests.py at some point.
Have you tried directly testing the models individually? Like:
python manage.py test dayofweeks
HTH,
--
Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---