Monday, August 30, 2010

Re: Overriding flatpages class meta

I was try

class Meta(FlatPage.Meta):

but when runserver there is following error:

AttributeError: type object 'FlatPage' has no attribute 'Meta'

any other solution to try?

Thanks


On Aug 30, 12:53 am, Steve Holden <holden...@gmail.com> wrote:
> On 8/29/2010 6:51 PM, Goran wrote:
>
> > Thanks for the answer Steve. I'm Django and Python novice and here is
> > what I was try. But it doesn't work.
>
> > from django.contrib.flatpages.models import FlatPage
>
> >classNewFlatpage(FlatPage):
>
> >    classMeta:
>
> TheMetaclasswould need to subclass FlatPage.Meta, otherwise it won't
> have the necessary FlatPage special sauces. I don't guarantee even that
> will work, but try
>
> classNewFlatpage(FlatPage):
>
>    classMeta(FlatPage.Meta):
>         verbose_name_plural = "New_name"
>
> regards
>  Steve
>
>
>
> >         verbose_name_plural = "New_name"
>
> > On Aug 26, 4:39 am, Steve Holden <holden...@gmail.com> wrote:
> >> On 8/25/2010 8:26 PM, Goran wrote:> I need another verbose_name_plural for Flat pages so i need to
> >>> overrideclassmetafor it right? How can I do that?
>
> >> [Caveat: this is a guess from general Python knowledge]
>
> >> Have you tried creating a subclass of Flatpage, whose body simply
> >> declares aMetaclasswhich is a subclass of Flatpage.Meta?
>
> >> regards
> >>  Steve
> >> --
> >> DjangoCon US 2010 September 7-9http://djangocon.us/
>
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

--
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?hl=en.

No comments:

Post a Comment