Also (and I know I've posted this a ton lately, but I think it's
relevant) here's a talk describing the general steps I follow when
building apps for Mezzanine: https://www.youtube.com/watch?v=yVAmMXES2EU
It touches on how to uses Mezzanine's models, admin, and template utilities.
On 2017-10-11 7:08 PM, Eduardo Rivas wrote:
Hi Tom.
You need to register your model in the admin. You can use
mezzanine.blog.admin as an example:
https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/blog/admin.py.
This admin configuration is a bit complex, so I recommend you become
familiar with Django's admin in general before diving into it. Have
you completed the official Django tutorial? It should introduce you to
all these concepts:
https://docs.djangoproject.com/en/1.11/intro/tutorial01/
On 2017-10-11 7:02 PM, Tom Tanner wrote:
Hey all,
When I go to the Admin section of my site, I see the "Blog posts"
under "Content" on the left. I want to make a new "Content" section
called "Projects." It would be similar to a page of blog posts. But
I'm not sure how to start doing this.
Here's what my app's `models.py` looks like.
|
from__future__ importunicode_literals
fromdjango.db importmodels
fromdjango.core.urlresolvers importreverse
fromdjango.utils.translation importugettext_lazy as_
frommezzanine.conf importsettings
frommezzanine.core.fields importFileField
frommezzanine.core.models importDisplayable,Ownable,RichText,Slugged
frommezzanine.generic.fields importCommentsField,RatingField
frommezzanine.utils.models importAdminThumbMixin,upload_to
# Create your models here.
classProjectsPage(Displayable):
'''
A page representing the format of the page that
has links to standalone, project projects
'''
categories =models.ManyToManyField("ProjectCategory",
verbose_name=_("Categories"),
blank=True,related_name="projectposts")
allow_comments =models.BooleanField(verbose_name=_("Allow comments"),
default=True)
comments =CommentsField(verbose_name=_("Comments"))
featured_image =FileField(verbose_name=_("Featured Image"),
upload_to=upload_to("project.ProjectPost.featured_image","project"),
format="Image",max_length=255,null=True,blank=True)
related_posts =models.ManyToManyField("self",
verbose_name=_("Related posts"),blank=True)
admin_thumb_field ="featured_image"
classMeta:
verbose_name=_("Project link")
verbose_name_plural=_("Project links")
ordering=("-publish_date",)
classProjectCategory(Slugged):
'''
A category for grouping project links into a series
'''
classMeta:
verbose_name=_("Project Category")
verbose_name_plural=_("Project Categories")
ordering=("title",)
|
I basically copied a section of `mezzanine/blog/models.py`.
But "Projects" won't show up in my Admin menu. What am I doing wrong?
--
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 mezzanine-users+unsubscr...@googlegroups.com
<mailto:mezzanine-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.