Re: [mezzanine-users] Re: BlogPost extension
Great, glad to hear you figured it out Pushkar! On Sun, Apr 5, 2015 at 12:11 PM, Pushkar Paranjpe wrote: > OK! Please ignore that last error message. I was doing something really > silly. > > Having defined the "defaults" for all the non-null fields I ran: > > python manage.py schemamigration mezzanine.blog --auto --stdout > >> theme/migrations/0001_blog_customization.py >> > > then > > python manage.py migrate theme >> > > (Also updated the blog_fieldsets in the admin.py) > > And it all worked marvellously well! Columns were added to the DB table > (checked with dbshell (PRAGMA table_info(blog_blogpost);) ), admin page for > blog post is also rendering all the extra fields. > > Thanks again. > > Pushkar > > On Sunday, 5 April 2015 21:11:18 UTC+5:30, Pushkar Paranjpe wrote: >> >> Hi Josh, >> >> I am getting the following error when I ask it to migrate: >> >> Traceback (most recent call last): >> File "manage.py", line 28, in >> execute_from_command_line(sys.argv) >> File "/usr/lib/python2.7/dist-packages/django/core/ >> management/__init__.py", line 399, in execute_from_command_line >> utility.execute() >> File "/usr/lib/python2.7/dist-packages/django/core/ >> management/__init__.py", line 392, in execute >> self.fetch_command(subcommand).run_from_argv(self.argv) >> File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", >> line 242, in run_from_argv >> self.execute(*args, **options.__dict__) >> File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", >> line 285, in execute >> output = self.handle(*args, **options) >> File "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2. >> 7.egg/south/management/commands/migrate.py", line 81, in handle >> apps = [Migrations(app)] >> File "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2. >> 7.egg/south/migration/base.py", line 64, in __call__ >> self.instances[app_label] = super(MigrationsMetaclass, self).__call__ >> (app_label_to_app_module(app_label), **kwds) >> File "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2. >> 7.egg/south/migration/utils.py", line 41, in app_label_to_app_module >> app = models.get_app(app_label) >> File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", >> line 190, in get_app >> raise ImproperlyConfigured("App with label %s could not be found" % >> app_label) >> django.core.exceptions.ImproperlyConfigured: App with label py could not >> be found >> >> >> Please let me know if you have any clues to the cause of the error. >> >> Cheers! >> Pushkar >> >> >> >> >> -- > 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: BlogPost extension
OK! Please ignore that last error message. I was doing something really silly. Having defined the "defaults" for all the non-null fields I ran: python manage.py schemamigration mezzanine.blog --auto --stdout > > theme/migrations/0001_blog_customization.py > then python manage.py migrate theme > (Also updated the blog_fieldsets in the admin.py) And it all worked marvellously well! Columns were added to the DB table (checked with dbshell (PRAGMA table_info(blog_blogpost);) ), admin page for blog post is also rendering all the extra fields. Thanks again. Pushkar On Sunday, 5 April 2015 21:11:18 UTC+5:30, Pushkar Paranjpe wrote: > > Hi Josh, > > I am getting the following error when I ask it to migrate: > > Traceback (most recent call last): > File "manage.py", line 28, in > execute_from_command_line(sys.argv) > File > "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 399, in execute_from_command_line > utility.execute() > File > "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 392, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", > line 242, in run_from_argv > self.execute(*args, **options.__dict__) > File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", > line 285, in execute > output = self.handle(*args, **options) > File > "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/management/commands/migrate.py" > , line 81, in handle > apps = [Migrations(app)] > File > "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/migration/base.py" > , line 64, in __call__ > self.instances[app_label] = super(MigrationsMetaclass, self).__call__( > app_label_to_app_module(app_label), **kwds) > File > "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/migration/utils.py" > , line 41, in app_label_to_app_module > app = models.get_app(app_label) > File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", > line 190, in get_app > raise ImproperlyConfigured("App with label %s could not be found" % > app_label) > django.core.exceptions.ImproperlyConfigured: App with label py could not > be found > > > Please let me know if you have any clues to the cause of the error. > > Cheers! > Pushkar > > > > > -- 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: BlogPost extension
Hi Josh, I am getting the following error when I ask it to migrate: Traceback (most recent call last): File "manage.py", line 28, in execute_from_command_line(sys.argv) File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py" , line 399, in execute_from_command_line utility.execute() File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py" , line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/management/commands/migrate.py" , line 81, in handle apps = [Migrations(app)] File "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/migration/base.py" , line 64, in __call__ self.instances[app_label] = super(MigrationsMetaclass, self).__call__( app_label_to_app_module(app_label), **kwds) File "/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/migration/utils.py" , line 41, in app_label_to_app_module app = models.get_app(app_label) File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 190, in get_app raise ImproperlyConfigured("App with label %s could not be found" % app_label) django.core.exceptions.ImproperlyConfigured: App with label py could not be found Please let me know if you have any clues to the cause of the error. Cheers! Pushkar -- 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: BlogPost extension
Yep! The approach I mentioned should leave existing entries intact On Thu, Apr 2, 2015 at 12:50 AM, Pushkar Paranjpe wrote: > Hi Josh, > > Deleting the db and migrations each time I add fields to a core mezzanine > model did feel a bit drastic and was killing the idea of South. > Thanks for your corrections. I will use them right away! > > By using your approach, it looks like the old entries in the DB will still > be intact, right ? (awesome!) > > Cheers! > Pushkar > On Monday, 30 March 2015 21:09:16 UTC+5:30, Josh Cartmell wrote: >> >> Hi Pushkar, for you and anyone else who comes across this, you do not >> have to delete your db and migrations to add fields from EXTRA_MODEL_FIELDS >> >> The correct way to add the image field to BlogPost would be: >> >> python manage.py schemamigration mezzanine.blog --auto --stdout > >> path/to_store_the/migration_file.py >> python manage.py migrate app_migrations_were_stored_in >> >> Good luck! >> >> On Fri, Mar 27, 2015 at 3:26 AM, Pushkar Paranjpe >> wrote: >> >>> Update: >>> >>> A cleaned-up work-flow: >>> >>>1. Add custom fields using the EXTRA_MODEL_FIELDS in settings.py >>>2. Update respective model's fieldsets in admin.py >>>3. delete dev.db >>>4. delete all migrations .py under your custom theme app >>>5. python manage.py createdb --noinput >>>6. python manage.py syncdb >>>7. python manage.py migrate >>>8. Login to admin and Go to blog posts section and add new post with >>>your custom fields :) >>> >>> *NOTE:* Of course, you will lose all previous blog posts, pages data >>> that was entered through the cms earlier. You will have to re-add that >>> stuff. >>> If anyone knows how to automate this part, given the data to be entered >>> that would be very valuable :) >>> >>> Cheers! >>> Pushkar >>> >>> >>> On Friday, 27 March 2015 05:09:40 UTC+5:30, Pushkar Paranjpe wrote: Correct me if I am missing something. Relatively new to Mezzanine and to Django :) I managed to add a custom field *header_image* to the BlogPost model using the EXTRA_MODEL_FIELDS approach. Just have to add one note in case someone else finds this useful: *If* the DB already exists and then the above extra field is injected, The following command *does not pick it up*: python manage.py schemamigration theme --auto I needed to delete the dev.db, clean-up the migration history and run the following command for the custom fields to be incorporated into the BlogPost model: python manage.py createdb --noinput (then ... python manage.py schemamigration theme --initial python manage.py migrate theme --fake ... ) On Tuesday, 11 October 2011 18:29:07 UTC+5:30, wesley wrote: > > Hi, > > I'm a new mezzanine user (great framework !), I would like to create a > new class of BlogPost with some custom fields. > Can we just inherit from BlogPost class and create an admin class > (like Page in the documentation/tutorial) ? > > If not what is the best way to accomplish that ? > > Thanks for your help. > > -- >>> 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-use...@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: BlogPost extension
Hi Josh, Deleting the db and migrations each time I add fields to a core mezzanine model did feel a bit drastic and was killing the idea of South. Thanks for your corrections. I will use them right away! By using your approach, it looks like the old entries in the DB will still be intact, right ? (awesome!) Cheers! Pushkar On Monday, 30 March 2015 21:09:16 UTC+5:30, Josh Cartmell wrote: > > Hi Pushkar, for you and anyone else who comes across this, you do not have > to delete your db and migrations to add fields from EXTRA_MODEL_FIELDS > > The correct way to add the image field to BlogPost would be: > > python manage.py schemamigration mezzanine.blog --auto --stdout > > path/to_store_the/migration_file.py > python manage.py migrate app_migrations_were_stored_in > > Good luck! > > On Fri, Mar 27, 2015 at 3:26 AM, Pushkar Paranjpe > wrote: > >> Update: >> >> A cleaned-up work-flow: >> >>1. Add custom fields using the EXTRA_MODEL_FIELDS in settings.py >>2. Update respective model's fieldsets in admin.py >>3. delete dev.db >>4. delete all migrations .py under your custom theme app >>5. python manage.py createdb --noinput >>6. python manage.py syncdb >>7. python manage.py migrate >>8. Login to admin and Go to blog posts section and add new post with >>your custom fields :) >> >> *NOTE:* Of course, you will lose all previous blog posts, pages data >> that was entered through the cms earlier. You will have to re-add that >> stuff. >> If anyone knows how to automate this part, given the data to be entered >> that would be very valuable :) >> >> Cheers! >> Pushkar >> >> >> On Friday, 27 March 2015 05:09:40 UTC+5:30, Pushkar Paranjpe wrote: >>> >>> Correct me if I am missing something. Relatively new to Mezzanine and to >>> Django :) >>> >>> I managed to add a custom field *header_image* to the BlogPost model >>> using the EXTRA_MODEL_FIELDS approach. >>> >>> Just have to add one note in case someone else finds this useful: >>> >>> *If* the DB already exists and then the above extra field is injected, >>> >>> The following command *does not pick it up*: >>> python manage.py schemamigration theme --auto >>> >>> I needed to delete the dev.db, clean-up the migration history and run >>> the following command for the custom fields to be incorporated into the >>> BlogPost model: >>> python manage.py createdb --noinput >>> >>> (then ... >>> python manage.py schemamigration theme --initial >>> python manage.py migrate theme --fake ... ) >>> >>> >>> >>> On Tuesday, 11 October 2011 18:29:07 UTC+5:30, wesley wrote: Hi, I'm a new mezzanine user (great framework !), I would like to create a new class of BlogPost with some custom fields. Can we just inherit from BlogPost class and create an admin class (like Page in the documentation/tutorial) ? If not what is the best way to accomplish that ? Thanks for your help. -- >> 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-use...@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: BlogPost extension
Hi Josh, Deleting the db and migrations each time I add fields to a core mezzanine model did feel a bit drastic and was killing the idea of South. Thanks for your corrections. I will use them right away! By using your approach, it looks like the old entries in the DB will still be intact, right ? (awesome!) Cheers! Pushkar On Monday, 30 March 2015 21:09:16 UTC+5:30, Josh Cartmell wrote: > > Hi Pushkar, for you and anyone else who comes across this, you do not have > to delete your db and migrations to add fields from EXTRA_MODEL_FIELDS > > The correct way to add the image field to BlogPost would be: > > python manage.py schemamigration mezzanine.blog --auto --stdout > > path/to_store_the/migration_file.py > python manage.py migrate app_migrations_were_stored_in > > Good luck! > > On Fri, Mar 27, 2015 at 3:26 AM, Pushkar Paranjpe > wrote: > >> Update: >> >> A cleaned-up work-flow: >> >>1. Add custom fields using the EXTRA_MODEL_FIELDS in settings.py >>2. Update respective model's fieldsets in admin.py >>3. delete dev.db >>4. delete all migrations .py under your custom theme app >>5. python manage.py createdb --noinput >>6. python manage.py syncdb >>7. python manage.py migrate >>8. Login to admin and Go to blog posts section and add new post with >>your custom fields :) >> >> *NOTE:* Of course, you will lose all previous blog posts, pages data >> that was entered through the cms earlier. You will have to re-add that >> stuff. >> If anyone knows how to automate this part, given the data to be entered >> that would be very valuable :) >> >> Cheers! >> Pushkar >> >> >> On Friday, 27 March 2015 05:09:40 UTC+5:30, Pushkar Paranjpe wrote: >>> >>> Correct me if I am missing something. Relatively new to Mezzanine and to >>> Django :) >>> >>> I managed to add a custom field *header_image* to the BlogPost model >>> using the EXTRA_MODEL_FIELDS approach. >>> >>> Just have to add one note in case someone else finds this useful: >>> >>> *If* the DB already exists and then the above extra field is injected, >>> >>> The following command *does not pick it up*: >>> python manage.py schemamigration theme --auto >>> >>> I needed to delete the dev.db, clean-up the migration history and run >>> the following command for the custom fields to be incorporated into the >>> BlogPost model: >>> python manage.py createdb --noinput >>> >>> (then ... >>> python manage.py schemamigration theme --initial >>> python manage.py migrate theme --fake ... ) >>> >>> >>> >>> On Tuesday, 11 October 2011 18:29:07 UTC+5:30, wesley wrote: Hi, I'm a new mezzanine user (great framework !), I would like to create a new class of BlogPost with some custom fields. Can we just inherit from BlogPost class and create an admin class (like Page in the documentation/tutorial) ? If not what is the best way to accomplish that ? Thanks for your help. -- >> 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-use...@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: BlogPost extension
Hi Pushkar, for you and anyone else who comes across this, you do not have to delete your db and migrations to add fields from EXTRA_MODEL_FIELDS The correct way to add the image field to BlogPost would be: python manage.py schemamigration mezzanine.blog --auto --stdout > path/to_store_the/migration_file.py python manage.py migrate app_migrations_were_stored_in Good luck! On Fri, Mar 27, 2015 at 3:26 AM, Pushkar Paranjpe wrote: > Update: > > A cleaned-up work-flow: > >1. Add custom fields using the EXTRA_MODEL_FIELDS in settings.py >2. Update respective model's fieldsets in admin.py >3. delete dev.db >4. delete all migrations .py under your custom theme app >5. python manage.py createdb --noinput >6. python manage.py syncdb >7. python manage.py migrate >8. Login to admin and Go to blog posts section and add new post with >your custom fields :) > > *NOTE:* Of course, you will lose all previous blog posts, pages data that > was entered through the cms earlier. You will have to re-add that stuff. > If anyone knows how to automate this part, given the data to be entered > that would be very valuable :) > > Cheers! > Pushkar > > > On Friday, 27 March 2015 05:09:40 UTC+5:30, Pushkar Paranjpe wrote: >> >> Correct me if I am missing something. Relatively new to Mezzanine and to >> Django :) >> >> I managed to add a custom field *header_image* to the BlogPost model >> using the EXTRA_MODEL_FIELDS approach. >> >> Just have to add one note in case someone else finds this useful: >> >> *If* the DB already exists and then the above extra field is injected, >> >> The following command *does not pick it up*: >> python manage.py schemamigration theme --auto >> >> I needed to delete the dev.db, clean-up the migration history and run the >> following command for the custom fields to be incorporated into the >> BlogPost model: >> python manage.py createdb --noinput >> >> (then ... >> python manage.py schemamigration theme --initial >> python manage.py migrate theme --fake ... ) >> >> >> >> On Tuesday, 11 October 2011 18:29:07 UTC+5:30, wesley wrote: >>> >>> Hi, >>> >>> I'm a new mezzanine user (great framework !), I would like to create a >>> new class of BlogPost with some custom fields. >>> Can we just inherit from BlogPost class and create an admin class >>> (like Page in the documentation/tutorial) ? >>> >>> If not what is the best way to accomplish that ? >>> >>> Thanks for your help. >>> >>> -- > 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.
[mezzanine-users] Re: BlogPost extension
Update: A cleaned-up work-flow: 1. Add custom fields using the EXTRA_MODEL_FIELDS in settings.py 2. Update respective model's fieldsets in admin.py 3. delete dev.db 4. delete all migrations .py under your custom theme app 5. python manage.py createdb --noinput 6. python manage.py syncdb 7. python manage.py migrate 8. Login to admin and Go to blog posts section and add new post with your custom fields :) *NOTE:* Of course, you will lose all previous blog posts, pages data that was entered through the cms earlier. You will have to re-add that stuff. If anyone knows how to automate this part, given the data to be entered that would be very valuable :) Cheers! Pushkar On Friday, 27 March 2015 05:09:40 UTC+5:30, Pushkar Paranjpe wrote: > > Correct me if I am missing something. Relatively new to Mezzanine and to > Django :) > > I managed to add a custom field *header_image* to the BlogPost model > using the EXTRA_MODEL_FIELDS approach. > > Just have to add one note in case someone else finds this useful: > > *If* the DB already exists and then the above extra field is injected, > > The following command *does not pick it up*: > python manage.py schemamigration theme --auto > > I needed to delete the dev.db, clean-up the migration history and run the > following command for the custom fields to be incorporated into the > BlogPost model: > python manage.py createdb --noinput > > (then ... > python manage.py schemamigration theme --initial > python manage.py migrate theme --fake ... ) > > > > On Tuesday, 11 October 2011 18:29:07 UTC+5:30, wesley wrote: >> >> Hi, >> >> I'm a new mezzanine user (great framework !), I would like to create a >> new class of BlogPost with some custom fields. >> Can we just inherit from BlogPost class and create an admin class >> (like Page in the documentation/tutorial) ? >> >> If not what is the best way to accomplish that ? >> >> Thanks for your help. >> >> -- 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: BlogPost extension
Correct me if I am missing something. Relatively new to Mezzanine and to Django :) I managed to add a custom field *header_image* to the BlogPost model using the EXTRA_MODEL_FIELDS approach. Just have to add one note in case someone else finds this useful: *If* the DB already exists and then the above extra field is injected, The following command *does not pick it up*: python manage.py schemamigration theme --auto I needed to delete the dev.db, clean-up the migration history and run the following command for the custom fields to be incorporated into the BlogPost model: python manage.py createdb --noinput (then ... python manage.py schemamigration theme --initial python manage.py migrate theme --fake ... ) On Tuesday, 11 October 2011 18:29:07 UTC+5:30, wesley wrote: > > Hi, > > I'm a new mezzanine user (great framework !), I would like to create a > new class of BlogPost with some custom fields. > Can we just inherit from BlogPost class and create an admin class > (like Page in the documentation/tutorial) ? > > If not what is the best way to accomplish that ? > > Thanks for your help. > > -- 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.