Hello,
I'm trying to get a page processor to work one a custom page model.
The custom app loads as well as the custom page model. I've also added
*page_processors.autodiscover()
*within the *urls.py *but nothing changed. There aren't any errors showing
and I don't see any extra sql searches when I run a Category Page.
I'm running Python 2.7.3, Django 1.6.4 and Mezzanine 3.1.4.
*models.py*
*class Category(Page, RichText):*
> featured_image = FileField(verbose_name=_("Featured Image"),
> upload_to=upload_to("location.Category.featured_image",
> "locations"),
> format="Image", max_length=255, null=True, blank=True)
> locations = models.ManyToManyField("Location", blank=True,
> verbose_name=_("Locations"),
> through=Location.categories.through)
> class Meta:
> verbose_name = _("Location Category")
> verbose_name_plural = _("Location Categories")
>
...
> *class Location(AbstractLocation, Displayable, RichText, AdminThumbMixin):*
> categories = models.ManyToManyField("Category", blank=True,
> verbose_name=_("Location
> Categories"))
> image = models.CharField(_("Image"), max_length=100, blank=True,
> null=True)
> admin_thumb_field = "image"
>
> class Meta:
> verbose_name = _("Location")
> verbose_name_plural = _("Locations")
>
> @models.permalink
> def get_absolute_url(self):
> return ("location", (), {"slug": self.slug})
*page_processors.py*
> *@processor_for(Category)def category_processor(request, page):*
> locations = Location.objects.published(for_user=request.user).filter(
> page.category.filters()).distinct()
> sub_categories = page.category.children.published()
> child_categories = Category.objects.filter(id__in=sub_categories)
> return {"locations": locations, "child_categories": child_categories}
>
How can I discover what the issue is?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.