If you're failry strong in python, but not Django and are working with
Mezzanine, then you do need to do some digging into Django. And here's
the main pointers:

- Models are classes that represent the database structure. They can
be extended, they can be marked abstract, but the primary thing to
remember is that model **fields** cannot be overwritten. Model fields
being attributes of the class that are extending
django.db.models.Field. The represent table fields and therefore are
actively prevented from being extended.
- Database tables are migrated using Django migrations. In general
it's not necessary to know the database structure let alone even touch
it. This is only needed for specialized cases, optimizations and
legacy databases.
- Django form fields have a widget kwarg in their __init__, which can
be used to override the widget at runtime. Additionally, the Django
Form class has a metaclass attribute "widgets" which is a dictionary
mapping field names to widgets.

These points are all accessible from
https://docs.djangoproject.com/en/1.11/ and quite a bit of it covered
in the tutorial.

Mezzanine:
- A blog image is already available, when the following is activated
in settings:

# Setting to turn on featured images for blog posts. Defaults to False.
#
# BLOG_USE_FEATURED_IMAGE = True
- The default widget for a Mezzanine FileField is from
filebrowser_safe. It should be possible to set this to
django.forms.ClearableFileInput, though I've not tried it.

Hope this helps.

On Fri, Sep 15, 2017 at 2:30 PM, Ryan M <[email protected]> wrote:
>
> I have been migrating my existing blog to Mezzanine.  It has been a great
> experience so far.  Mezzanine has been able to accommodate all of the
> features on my "wish list" so far with the exception of the few "hiccups"
> below.  Fortunately, I am positive that these outstanding problems can be
> overcome, it's just a matter of me learning more about Mezzanine and Django.
> I'd appreciate your help!
>
> 1)
> I want to have a "create new post" button that links to a "form" for
> creating a blog post.  The form will ask the user for a blog post title,
> content, and an optional featured image.  The featured image will prompt an
> upload that must work on smartphones.
> So far I am able to get all of this to work except for the image upload
> part.  I've tried a few different ways of setting it up - in some cases the
> upload image button doesn't do anything, in other cases it launches a new
> window with the admin content management gui, and with some tweaking i can
> get the upload button to work but the site bombs when the "request.FILES"
> object is passed.  The admin content management gui isn't really ideal for
> my blog, i'd prefer for it to go directly to an upload prompt.
>
> 2)
> I added two new columns to my blog_blogPost table in the database, but -
> unsurprisingly - these columns are not accessible when I refer to them in
> the blog detail or blog list pages.  I suspect they need to be added to the
> model, not sure how to do that.
>
>
> I am thinking I need to ditch the standard "blog" app and instead make my
> own blog app that somehow extends the default blog app.  I am not 100% sure
> about how to do this, but its on my short list of possible options for
> resolving the issues above.
>
> I am fairly strong with python and web design, but I'm still learning
> django.  If you steer me in the right direction, I think I can figure it
> out.
>
> Thanks for the help!
> Ryan
>
> --
> 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.



-- 
Melvyn Sopacua

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

Reply via email to