Hey Cesar, you also need to add the name of the app to your INSTALLED_APPS
setting.  In your example that would mean adding "app"


On Sun, Jun 1, 2014 at 1:50 AM, Cesar Perales <[email protected]>
wrote:

> I added a  field using EXTRA_MODEL_FIELDS, edited in database and tried
> showing them in the template, this works ok.
>
> But i can't see the field in the admin page, this is the code i used:
>
> *settings.py:*
>
> EXTRA_MODEL_FIELDS = (
>     (
>         "mezzanine.blog.models.BlogPost.sidebar_text",
>         "TextField",
>         ("Sidebar Text",),
>         {"blank": True},
>     ),
> )
>
> *admin.py:*
>
> from copy import deepcopy
> from django.contrib import admin
> from mezzanine.blog.admin import BlogPostAdmin
> from mezzanine.blog.models import BlogPost
>
> blog_fieldsets = deepcopy(BlogPostAdmin.fieldsets)
> blog_fieldsets[0][1]["fields"] += ("sidebar_text",)
>
> class MyBlogPostAdmin(BlogPostAdmin.fieldsets):
> BlogPostAdmin.fieldsets = blog_fieldsets
>
> admin.site.unregister(BlogPost)
> admin.site.register(BlogPost, MyBlogPostAdmin)
>
>
>
> *My admin.py is not been loaded:*
>
> I wrote "print 1/0" in admin,py and gives no error.
> I placed the admin,py code in  urls,py and all works, showing the text
> field in the admin page.
>
> *Why is not loading ?*
>
> I was reading about admin.autodiscover() been responsible for loading this
> file,  and saw in its code that looped trough INSTALLED_APPS to load
> admin,py, so this made me think i need to install an app because all i did
> to install mezzanine was "mezzanine-project project" and  then i started
> copying the template files to modifying them.   I didn't use "python
> manage.py startapp app" at any moment.
>
> So my question is, i'm do it wrong? is the right way?:
>
> mezzanine-project project
> python manage.py startapp app
>
>
> and then put admin.py inside the app folder, or there is another reason
> admin.py is not been loaded?
>
> 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.
>

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