On Fri, Jul 18, 2008 at 8:44 PM, Justin Myers <[EMAIL PROTECTED]> wrote:

>
> Hello again! Still working on the blogging app I mentioned a couple of
> days ago for my student newspaper. It's working on our production
> server right now (so some of the other editors can check it out and
> make suggestions), though I'll naturally be making some tweaks here
> and there.
>
> Right now, though, I'm having a bit of trouble with the admin
> interface. I'm trying to put the slugField into a collapsed field
> group, which we usually do to keep people from thinking they have to
> change it. For whatever reason, though, I keep getting 500s when I try
> to set it up this way. The error I'm getting (full traceback after
> this message) is "FieldDoesNotExist: Blog has no field named 's'".
>
> Here's the model:
>
> ---
>
> class Blog(models.Model):
>    title = models.CharField(max_length=100)
>    description = models.TextField()
>    section = models.ForeignKey(Section,db_index=True)
>    slug = models.SlugField(prepopulate_from=('title',),
> help_text="Used for URLs. Autogenerated from title.")
>
>    def __unicode__(self):
>        return self.title
>
>    def get_absolute_url(self):
>        return "/blogs/%s/" % self.slug
>
>    class Meta:
>        ordering = ['title']
>
>    class Admin:
>        list_display = ('title', 'section')
>        fields = (
>            (None, {'fields': ('title', 'description', 'section')}),
>            ("Don't touch unless you know what you're doing",
> {'fields': ('slug'), 'classes': 'collapse'}),
>        )
>

Python gothca: you've neglected to put a comma after 'slug' in 'fields':
('slug').  Single-element tuples need to have a comma after their one
element to force them to be tuples.  In this case the single element is
iterable so when code goes to iterate over every element in what it is
expecting to be a tuple it iterates over every letter in the string.

Karen

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to