[mezzanine-users] Re: Cannot resolve bases ??

2015-09-13 Thread Niels Jakob Buch
Nevermind, I found a solution:

Run "python manage.py makemigrations myapp" first to create migrations 
focused on your app...

Before the usual createdb stuff...

I still dont understand why this is an issue with a clean database.

On Saturday, 12 September 2015 18:15:19 UTC+2, Niels Jakob Buch wrote:
>
> Im stuck in this annoying error. Trying to run the "python manage.py 
> createdb" in the project root
>
> [lots of error lines removed]
>   File "C:\Code\MEZ4\lib\site-packages\django\db\migrations\state.py", 
> line 270, in render_multiple
> "for more" % (new_unrendered_models, get_docs_version())
> django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [<
> ModelState: 'myapp.myPage'>]
> This can happen if you are inheriting models from an app with migrations (
> e.g. contrib.auth)
>  in an app with no migrations; see https://
> docs.djangoproject.com/en/1.8/topics/migrations/#dependencies for more
>
>
>
> I am having a page that is used for an app:
> class TrapsPage(Page, RichText):
> add_toc = models.BooleanField(_("Add TOC"), default=False,
>
>   help_text=_("Include a list of child 
> links"))
>
>
> class Meta:
> verbose_name = _("My Page")
> verbose_name_plural = _("My Pages")
>
>
> Can anyone point in a meaningful direction for further investigation...?
>
>

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


[mezzanine-users] Re: Stuck on something simple... trying to add a field to blogcategory

2015-09-13 Thread J M
*Bump*  Anyone?? 

On Friday, September 11, 2015 at 3:16:25 AM UTC-4, J M wrote:
>
> I'm trying to to add a new field to blog category called "catType".  The 
> purpose of this new 1 character field is to use it in templates (eg. if 
> catType = '-' don't display the category or '+' to highlight the 
> category).  I need to be able to update it from the category admin page.
>
> I've looked for help from a bunch of various guides/instructions eg:
> http://mezzanine.jupo.org/docs/model-customization.html
>
> https://stackoverflow.com/questions/15345067/add-a-field-to-mezzanine-blogpost
>  
>
> https://stackoverflow.com/questions/19935812/mezzanine-field-missing-from-the-form
>
> So far I've only got this working:
>
> in settings.py:
> EXTRA_MODEL_FIELDS = (
> (   "mezzanine.blog.models.BlogCategory.catType",
> "django.db.models.CharField",
> ("Category Type",),
> {"max_length":1, "blank": False, "null": True, "default": True},
> ),
> )
>
>
> sudo python manage.py makemigrations
> python manage.py syncdb
>
> the new field  "catType" is there...
>
> sqlite> .schema blog_blogcategory
> CREATE TABLE "blog_blogcategory" ("id" integer NOT NULL PRIMARY KEY 
> AUTOINCREMENT, "title" varchar(500) NOT NULL, "slug" varchar(2000) NULL, 
> "site_id" integer NOT NULL REFERENCES "django_site" ("id"), "catType" 
> varchar(1) NULL);
> CREATE INDEX "blog_blogcategory_9365d6e7" ON "blog_blogcategory" (
> "site_id");
>
>
> ===
> this part isn't working...
> ===
>
> I've created this "admin.py" and put it in my project's directory...
>
> from copy import deepcopy
> from django.contrib import admin
> from mezzanine.blog.admin import BlogCategoryAdmin
> from mezzanine.blog.models import BlogCategory
>
> blog_fieldsets = deepcopy(BlogCategoryAdmin.fieldsets)
> blog_fieldsets[0][1]["fields"].extend(["catType"])
>
> class MyBlogCategoryAdmin(BlogCategoryAdmin):
> fieldsets = blog_fieldsets
>
> admin.site.unregister(BlogCategory)
> admin.site.register(BlogCategory, MyBlogCategoryAdmin)
>
>
> I've created this "models.py" and put it in my project's directory...
>
> from django.db import models
> from mezzanine.pages.models import Page
> print "in models"
> print "in models"
> print "in models"
> class MyPage(Page):
>   catType = models.TextField(max_length=1, blank=True, null=True)
>
>
> My problem is that I don't really know what the correct steps are.
>
> If I add "admin" to apps I get "models aren't loaded yet".  
>
> Any assistance would be much appreciated!
>
>

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


Re: [mezzanine-users] Re: Cannot resolve bases ??

2015-09-13 Thread Eduardo Rivas
I think Django wouldn't know how to create your application's tables
without the migration files. Migrations are required with every concrete
model in Django 1.7 and up.

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


Re: [mezzanine-users] Re: Cannot resolve bases ??

2015-09-13 Thread Niels Jakob Buch
That explains the need for the first app-specific migrations.

What about mezzanine, does it come with built-in migrations.

On Sun, Sep 13, 2015 at 3:48 PM, Eduardo Rivas 
wrote:

> I think Django wouldn't know how to create your application's tables
> without the migration files. Migrations are required with every concrete
> model in Django 1.7 and up.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mezzanine Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mezzanine-users/x6oxLhpK7Io/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> 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.


Re: [mezzanine-users] Re: Cannot resolve bases ??

2015-09-13 Thread Ken Bolton
Hi Niels,

Mezzanine does come with built-in migrations; pages
,
blog
,
core
,
forms
,
and gallery

should interest you.

-ken

On Sun, Sep 13, 2015 at 10:27 AM, Niels Jakob Buch  wrote:

> That explains the need for the first app-specific migrations.
>
> What about mezzanine, does it come with built-in migrations.
>
> On Sun, Sep 13, 2015 at 3:48 PM, Eduardo Rivas 
> wrote:
>
>> I think Django wouldn't know how to create your application's tables
>> without the migration files. Migrations are required with every concrete
>> model in Django 1.7 and up.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Mezzanine Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/mezzanine-users/x6oxLhpK7Io/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> 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.
>

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


Re: [mezzanine-users] Re: Cannot resolve bases ??

2015-09-13 Thread Niels Jakob Buch
Now it all makes sense, thanks a lot!

On Sun, Sep 13, 2015 at 4:47 PM, Ken Bolton  wrote:

> Hi Niels,
>
> Mezzanine does come with built-in migrations; pages
> ,
> blog
> ,
> core
> ,
> forms
> ,
> and gallery
> 
> should interest you.
>
> -ken
>
> On Sun, Sep 13, 2015 at 10:27 AM, Niels Jakob Buch 
> wrote:
>
>> That explains the need for the first app-specific migrations.
>>
>> What about mezzanine, does it come with built-in migrations.
>>
>> On Sun, Sep 13, 2015 at 3:48 PM, Eduardo Rivas 
>> wrote:
>>
>>> I think Django wouldn't know how to create your application's tables
>>> without the migration files. Migrations are required with every concrete
>>> model in Django 1.7 and up.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Mezzanine Users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/mezzanine-users/x6oxLhpK7Io/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> 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.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mezzanine Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mezzanine-users/x6oxLhpK7Io/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> 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.


[mezzanine-users] Re: Stuck on something simple... trying to add a field to blogcategory

2015-09-13 Thread Josh B
Hey J M. You shouldn't need the models.py file. I think you if you add the 
following to your admin.py you will be good to go.

from copy import deepcopy
from django.contrib import admin
from mezzanine.blog.admin import BlogCategoryAdmin
from mezzanine.blog.models import BlogCategory

blog_fieldsets = deepcopy(BlogCategoryAdmin.fieldsets)
blog_fieldsets[0][1]["fields"].extend(["catType"])

class MyBlogCategoryAdmin(BlogCategoryAdmin):
fieldsets = blog_fieldsets

if BlogCategory in admin.site._registry:
  admin.site.unregister(BlogCategory)
admin.site.register(BlogCategory, MyBlogCategoryAdmin)

if BlogCategory in admin.site._registry:
  admin.site.unregister(BlogCategory)


On Sunday, September 13, 2015 at 9:56:13 AM UTC-6, J M wrote:
>
> *Bump*  Anyone?? 
>
> On Friday, September 11, 2015 at 3:16:25 AM UTC-4, J M wrote:
>>
>> I'm trying to to add a new field to blog category called "catType".  The 
>> purpose of this new 1 character field is to use it in templates (eg. if 
>> catType = '-' don't display the category or '+' to highlight the 
>> category).  I need to be able to update it from the category admin page.
>>
>> I've looked for help from a bunch of various guides/instructions eg:
>> http://mezzanine.jupo.org/docs/model-customization.html
>>
>> https://stackoverflow.com/questions/15345067/add-a-field-to-mezzanine-blogpost
>>  
>>
>> https://stackoverflow.com/questions/19935812/mezzanine-field-missing-from-the-form
>>
>> So far I've only got this working:
>>
>> in settings.py:
>> EXTRA_MODEL_FIELDS = (
>> (   "mezzanine.blog.models.BlogCategory.catType",
>> "django.db.models.CharField",
>> ("Category Type",),
>> {"max_length":1, "blank": False, "null": True, "default": True},
>> ),
>> )
>>
>>
>> sudo python manage.py makemigrations
>> python manage.py syncdb
>>
>> the new field  "catType" is there...
>>
>> sqlite> .schema blog_blogcategory
>> CREATE TABLE "blog_blogcategory" ("id" integer NOT NULL PRIMARY KEY 
>> AUTOINCREMENT, "title" varchar(500) NOT NULL, "slug" varchar(2000) NULL, 
>> "site_id" integer NOT NULL REFERENCES "django_site" ("id"), "catType" 
>> varchar(1) NULL);
>> CREATE INDEX "blog_blogcategory_9365d6e7" ON "blog_blogcategory" (
>> "site_id");
>>
>>
>> ===
>> this part isn't working...
>> ===
>>
>> I've created this "admin.py" and put it in my project's directory...
>>
>> from copy import deepcopy
>> from django.contrib import admin
>> from mezzanine.blog.admin import BlogCategoryAdmin
>> from mezzanine.blog.models import BlogCategory
>>
>> blog_fieldsets = deepcopy(BlogCategoryAdmin.fieldsets)
>> blog_fieldsets[0][1]["fields"].extend(["catType"])
>>
>> class MyBlogCategoryAdmin(BlogCategoryAdmin):
>> fieldsets = blog_fieldsets
>>
>> admin.site.unregister(BlogCategory)
>> admin.site.register(BlogCategory, MyBlogCategoryAdmin)
>>
>>
>> I've created this "models.py" and put it in my project's directory...
>>
>> from django.db import models
>> from mezzanine.pages.models import Page
>> print "in models"
>> print "in models"
>> print "in models"
>> class MyPage(Page):
>>   catType = models.TextField(max_length=1, blank=True, null=True)
>>
>>
>> My problem is that I don't really know what the correct steps are.
>>
>> If I add "admin" to apps I get "models aren't loaded yet".  
>>
>> Any assistance would be much appreciated!
>>
>>

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