[mezzanine-users] Field Injection Will Not Migrate

2015-11-19 Thread R.J. Jackson
Hello, so I have worked with Django for over a year now, and wanted to give 
Mezzanine a try but I have not gotten far with it.  I'm just doing some 
Field Injections and when I run a migrate command I get an error.


*settings.py*

EXTRA_MODEL_FIELDS = (
(   "mezzanine.blog.models.BlogPost.featured_post",
"BooleanField",
("Featured Post",),
{"blank": False, "null": False, "default": False},
),
)


Operations to perform:
  Synchronize unmigrated apps: customize, boot, filebrowser_safe, sitemaps, 
staticfiles, grappelli_safe
  Apply all migrations: core, redirects, django_comments, sessions, admin, 
twitter, galleries, sites, auth, blog, generic, contenttypes, conf, forms, 
pages
Synchronizing apps without migrations:
  Creating tables...
Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying blog.0007_auto_20151119_0048...Traceback (most recent call last):
  File "manage.py", line 14, in 
execute_from_command_line(sys.argv)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 354, in execute_from_command_line
utility.execute()
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 394, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 445, in execute
output = self.handle(*args, **options)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 
line 222, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/migrations/executor.py",
 
line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake, 
fake_initial=fake_initial)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/migrations/executor.py",
 
line 148, in apply_migration
state = migration.apply(state, schema_editor)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/migrations/migration.py",
 
line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, 
project_state)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/migrations/operations/fields.py",
 
line 62, in database_forwards
field,
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py",
 
line 179, in add_field
self._remake_table(model, create_fields=[field])
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py",
 
line 77, in _remake_table
self.effective_default(field)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/backends/base/schema.py",
 
line 211, in effective_default
default = field.get_db_prep_save(default, self.connection)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
 
line 710, in get_db_prep_save
prepared=False)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
 
line 1482, in get_db_prep_value
value = self.get_prep_value(value)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
 
line 1461, in get_prep_value
value = super(DateTimeField, self).get_prep_value(value)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
 
line 1317, in get_prep_value
return self.to_python(value)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
 
line 1420, in to_python
parsed = parse_datetime(value)
  File 
"/home/project/newenv/local/lib/python2.7/site-packages/django/utils/dateparse.py",
 
line 93, in parse_datetime
match = datetime_re.match(value)
TypeError: expected string or buffer


I have tried removing the code in the settings.py and running 
makemigration/migrate command but I continue to get the same error.  I have 
tried starting a new mezzanine project and still I get the same error.  I 
have been stuck on this for the past day.  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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Field Injection Will Not Migrate

2015-11-20 Thread R.J. Jackson
Yes you were dead on, I just deleted the migrations and it worked fine.

On Thursday, November 19, 2015 at 4:37:15 PM UTC-5, Eduardo Rivas wrote:
>
> It looks like you have a migration file inside Mezzanine's source code. If 
> you see the name of the migration that raises the exception, it's 
> blog.0007_auto_20151119 (meaning it was created on November 19, 2015, by 
> your injected field I presume). Remove that file and the associated .pyc 
> file and Mezzanine should go back to normal.
>
> Now, regarding field injection in Mezzanine 4, it's not as simple as it 
> was in the Mezzanine 3 days. There are essentially two ways of doing it: 
> One is explained by the official docs 
> ,
>  
> and the other is a method developed by Josh Cartmell 
>  (look for the 
> field injection section in that article). I use the first one, as it is 
> less brittle and somewhat supported by Django itself. It is not as elegant 
> though, and will require you to manually maintain the migration history of 
> all models with injected fields and any model that inherits from them.
>
> Both methods have the same goal: to make sure that the migrations for your 
> injected fields exist in your project, not in Mezzanine's source. Doing 
> otherwise is a nightmare for collaborating with other devs and deploying.
>

-- 
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] Trying To Understand Mezzanine

2015-11-20 Thread R.J. Jackson
Hello,

So I had worked with Django and feel like I have a pretty good 
understanding of that.  When working with Mezzanine, Ive read through the 
docs and some tutorials, and still feel a little lost.  So from what I have 
read, its just a basic Django project, and implementing your own models, 
views...etc are fine.  So what I have done is created a simple featured 
project Boolean using field injection.  I would like the main page to 
display all the featured projects.  So am I correct to assume that the 
proper approach is to create your own web app, create a view that query's 
it from the DB, and then add it to the template?

Or maybe there is a tutorial or a specific part of the doc that you can 
recommend, I apologize if this is such a simple question i just keep going 
in circles.  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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Field Injection Will Not Migrate

2015-11-20 Thread R.J. Jackson
Thanks! Ill keep this in mind next time.  i managed to get the Field 
Injection to work.

On Thursday, November 19, 2015 at 8:23:24 PM UTC-5, Sam Kingston wrote:
>
> I just wanted to add there is a third way of doing this, and that is 
> creating a model in your own app and adding a OneToOne field to the Blog 
> model. I now use that method exclusively instead of EXTRA_MODEL_FIELDS and 
> it is much cleaner and easier to maintain. 

-- 
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] Remove the term "Blog" from URL

2015-11-24 Thread R.J. Jackson
Hello,

Whenever I add a blog post the url will be www.mysite.com/blog/mypost.

How do I go about removing blog from the url. 

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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Issues Getting Category

2015-11-25 Thread R.J. Jackson
So when I use the existing blog_post_list view and template thats set up 
with Mezzanine my blog posts display the categories for each post fine.

However when I'm trying to create my own view, and get all the blog posts I 
can't get the categories for each blog.

for x in blog_posts:
 print x.categories

blog.BlogCategory.None
blog.BlogCategory.None
blog.BlogCategory.None


Any idea what I'm 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.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Issues Getting Category

2015-11-26 Thread R.J. Jackson
Hi, thank you it was helpful.

I have a follow up question, lets say I wanted to do a check to see if 
category is == to a string, how can I do that?

I have tried using the if tag but it doesn't work.

On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford wrote:
>
> Perhaps the blog_post_list.html file might be of help. In mine, I find 
> this:
> {% with blog_post.categories.all as categories %}
>   {% if categories %}
> ...
> {% for category in categories %}
> {{ 
> category }}{% if not forloop.last %}, {% endif %}
> {% endfor %}
>   {% endif %}
> {% endwith %}
>
> That hopefully gives an idea how to fetch a category.
>
> And remember, you wouldn't expect to find a category object or objects if 
> one isn't already created.
>

-- 
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: Issues Getting Category

2015-11-27 Thread R.J. Jackson
Like I said I have tried working with tags and it doesn't work.  This is 
the code I had.

{% with x.categories.all as categories %}
{% if categories %}
{% for category in categories %}
{% if category == "news" %}
{{category}}
{% endif %}
{% endfor %}

On Thursday, November 26, 2015 at 4:03:21 PM UTC-5, Danny S wrote:
>
> On 27/11/2015 4:33 AM, R.J. Jackson wrote:
>
> Hi, thank you it was helpful. 
>
> I have a follow up question, lets say I wanted to do a check to see if 
> category is == to a string, how can I do that?
>
>
> Why  not read up on Django template tags? 
> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if
>
> There's several examples there using both == and %ifequal, see which one 
> works best for you.
>
> Seeya. Danny.
>
>
> I have tried using the if tag but it doesn't work.
>
> On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
> wrote: 
>>
>> Perhaps the blog_post_list.html file might be of help. In mine, I find 
>> this: 
>> {% with blog_post.categories.all as categories %}
>>   {% if categories %}
>> ...
>> {% for category in categories %}
>> {{ 
>> category }}{% if not forloop.last %}, {% endif %}
>> {% endfor %}
>>   {% endif %}
>> {% endwith %}
>>
>> That hopefully gives an idea how to fetch a category.
>>
>> And remember, you wouldn't expect to find a category object or objects if 
>> one isn't already created.
>>
> -- 
> 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: Issues Getting Category

2015-11-27 Thread R.J. Jackson
However if I don't put the if category == "news" part of it, it does show 
up fine. 

On Friday, November 27, 2015 at 10:14:10 AM UTC-5, R.J. Jackson wrote:
>
> Like I said I have tried working with tags and it doesn't work.  This is 
> the code I had.
>
> {% with x.categories.all as categories %}
> {% if categories %}
> {% for category in categories %}
> {% if category == "news" %}
> {{category}}
> {% endif %}
> {% endfor %}
>
> On Thursday, November 26, 2015 at 4:03:21 PM UTC-5, Danny S wrote:
>>
>> On 27/11/2015 4:33 AM, R.J. Jackson wrote:
>>
>> Hi, thank you it was helpful. 
>>
>> I have a follow up question, lets say I wanted to do a check to see if 
>> category is == to a string, how can I do that?
>>
>>
>> Why  not read up on Django template tags? 
>> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if
>>
>> There's several examples there using both == and %ifequal, see which one 
>> works best for you.
>>
>> Seeya. Danny.
>>
>>
>> I have tried using the if tag but it doesn't work.
>>
>> On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
>> wrote: 
>>>
>>> Perhaps the blog_post_list.html file might be of help. In mine, I find 
>>> this: 
>>> {% with blog_post.categories.all as categories %}
>>>   {% if categories %}
>>> ...
>>> {% for category in categories %}
>>> {{ 
>>> category }}{% if not forloop.last %}, {% endif %}
>>> {% endfor %}
>>>   {% endif %}
>>> {% endwith %}
>>>
>>> That hopefully gives an idea how to fetch a category.
>>>
>>> And remember, you wouldn't expect to find a category object or objects 
>>> if one isn't already created.
>>>
>> -- 
>> 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: Issues Getting Category

2015-11-27 Thread R.J. Jackson
Just in case anyone had the same issue I had to call the category title 
attribute.

On Friday, November 27, 2015 at 11:32:45 AM UTC-5, R.J. Jackson wrote:
>
> However if I don't put the if category == "news" part of it, it does show 
> up fine. 
>
> On Friday, November 27, 2015 at 10:14:10 AM UTC-5, R.J. Jackson wrote:
>>
>> Like I said I have tried working with tags and it doesn't work.  This is 
>> the code I had.
>>
>> {% with x.categories.all as categories %}
>> {% if categories %}
>> {% for category in categories %}
>> {% if category == "news" %}
>> {{category}}
>> {% endif %}
>> {% endfor %}
>>
>> On Thursday, November 26, 2015 at 4:03:21 PM UTC-5, Danny S wrote:
>>>
>>> On 27/11/2015 4:33 AM, R.J. Jackson wrote:
>>>
>>> Hi, thank you it was helpful. 
>>>
>>> I have a follow up question, lets say I wanted to do a check to see if 
>>> category is == to a string, how can I do that?
>>>
>>>
>>> Why  not read up on Django template tags? 
>>> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if
>>>
>>> There's several examples there using both == and %ifequal, see which one 
>>> works best for you.
>>>
>>> Seeya. Danny.
>>>
>>>
>>> I have tried using the if tag but it doesn't work.
>>>
>>> On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
>>> wrote: 
>>>>
>>>> Perhaps the blog_post_list.html file might be of help. In mine, I find 
>>>> this: 
>>>> {% with blog_post.categories.all as categories %}
>>>>   {% if categories %}
>>>> ...
>>>> {% for category in categories %}
>>>> {{ 
>>>> category }}{% if not forloop.last %}, {% endif %}
>>>> {% endfor %}
>>>>   {% endif %}
>>>> {% endwith %}
>>>>
>>>> That hopefully gives an idea how to fetch a category.
>>>>
>>>> And remember, you wouldn't expect to find a category object or objects 
>>>> if one isn't already created.
>>>>
>>> -- 
>>> 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.


[mezzanine-users] Field Injected: Column cannot be null

2015-12-03 Thread R.J. Jackson
So i injected a field and im trying to make it optional so i did something 
like this...

*EXTRA_MODEL_FIELDS = (*
* (   "mezzanine.blog.models.BlogPost.game_date",*
*"DateTimeField",*
*("Game Date",),*
*{"null": True, "blank": True},*
*),*
*)*

Now when I do the blog post and leave that field empty I get 

*(1048, "Column 'game_date' cannot be null")*

Can anyone help me out?

-- 
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] Field Injected: Column cannot be null

2015-12-03 Thread R.J. Jackson
Yes

-- 
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: Field Injected: Column cannot be null

2015-12-03 Thread R.J. Jackson
Something I just noticed.  When I save a blog post with a game_date, and 
then go back to it, remove the date and save it, it works fine.  However 
when creating it with out the game_date it gives me that cannot be null 
error.

-- 
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] Mezzanine - Remove “Category” from URL slug

2015-12-09 Thread R.J. Jackson


When working with Mezzainine, when i try to list the category posts it will 
show

www.example.com/category/mycategoryname

I need it to be:

www.example.com/mycategory/

In the documentation there are settings to remove it from blog and page 
posts but not for the actual category list post.

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