|
List Info
Thread: Curious problem, unable to see the ForeignKey objects in the admin interface
|
|
| Curious problem, unable to see the
ForeignKey objects in the admin
interface |

|
2006-09-30 05:19:47 |
|
Hi,
I just updated to the latest development version, and since then I am facing a very curious problem.
This is a simple blog app I am writing for a friend, and everything seems to work till we reach the admin side.
When I try to populate the datebase using the admin interface, I am unable to see the name of the authors or the title of the tags. Instead I get Tag object or Author object as I try making an article entry. Note I have no problem with anything expect the ManyToManyField and Foreign Key objects. Others are fine. The program seems to be working otherwise.
I am using SQlite in the development version ( plan to use MySQL in the production). Previous blogs what I have setup using (almost) exactly the same code does not have any problems. Did I make any trivial error? Can someone advise?
Thanks in advance
Please find the models.py --------
from django.db import models
# Create your models here.
class Author(models.Model): name = models.CharField
(maxlength = 40) slug = models.SlugField ('Slug', prepopulate_from =('name',), primary_key = True) email = models.EmailField ('email') def __repr__(self): return
self.name def get_absolute_url(self): return "/author/%s/" % self.slug class Admin: list_display = ("name", "slug", "email") search_fields =("slug", "email")
class Tag (models.Model): title = models.CharField (maxlength =32) slug = models.SlugField ('Slug', prepopulate_from =('title',)) def __repr__(self): return self.title def get_absolute_url(self):
return "/tag/%s/" % self.slug class Admin: list_display = ('title', 'slug') search_fields = ("title",) class Article (models.Model): author = models.ForeignKey
(Author) tags = models.ManyToManyField (Tag) headline =models.CharField (maxlength =44) slug = models.SlugField ('Slug', prepopulate_from = ("headline",)) date = models.DateTimeField('Date')
intro =models.CharField (maxlength=120) image = models.ImageField( 'Attach Image', upload_to='imgs', blank=True) body =models.TextField ('Body') def __repr__(self):
return self.headline def get_absolute_url(self): return "/blog/%s/%s/" % (self.date.strftime("%Y/%b/%d").lower(), self.slug) class Admin: list_display = ("headline", "slug", "date","intro","body")
search_fields = ("headline", "date", ) date_hierarchy = 'date' class Meta: ordering = ('-date',)
--~--~---------~--~----~------------~-------~--~----~
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 django-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|