Re: [mezzanine-users] How to set menus and to get postedata in Mezzanine Django

2014-04-01 Thread Jesse Carrigan
Ken, thank you for posting the link to the Effective Django tutorial. Looks 
really useful.

-- 
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] What to do next?

2014-04-01 Thread Tameen Malik
*processor_for.py*

from django import forms
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from .models import Book

class BookForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()

@processor_for(Author)
def author_form(request, page):
form = BookForm()
if request.method == POST:
form =BookForm(request.POST)
if form.is_valid():
# Form processing goes here.
redirect = request.path + ?submitted=true
return HttpResponseRedirect(redirect)
return {form: form}

*models.py*

from django.db import models
from time import time
class Book(models.Model):
   book_name= models.CharField(max_length=200, unique = True)
def __unicode__(self):
return self.book_name
*views.py*
def create_book (request):
if request.POST:
form = BookForm(request.POST, request.FILES)
if form.is_valid():
form.save()
return HttpResponseRedirect('/all/')
else:
form = BookForm()
args= {}
args.update(csrf(request))
args['form'] = form
return render_to_response('create_Book.html', args)

*urls.py*

urlpatterns += patterns('',
url(r'^/xyz/$', create_user))

*create_Book.html*

form action=/createuser/ method=post enctype=multipart/form-data{% 
csrf_token %}
{{form.as_ul}}
input type=submit name=submit value=create/
/form

This is what i am doing but still i am unable to access form. Where i am 
doing wrong. will be grateful to you. Please mark that what's wrong in code?

-- 
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] How to set menus and to get postedata in Mezzanine Django

2014-04-01 Thread Tameen Malik


 thank's ! hmm can you answer my second question, i posted today with title 
 `what to do next`!


-- 
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] Page Processors with Slug

2014-04-01 Thread Tameen Malik


 page_processor.py defining restaurant function. How to define url to 
 access this function can you please write this line of code?
  

-- 
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] Page Processors are not working!

2014-04-01 Thread Tameen Malik
processors.py file:

from django import forms
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from .models import Author

class AuthorForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()

@processor_for(Author)
def author_form(request, page):
form = AuthorForm()
if request.method == POST:
form = AuthorForm(request.POST)
if form.is_valid():
# Form processing goes here.
redirect = request.path + ?submitted=true
return HttpResponseRedirect(redirect)
return {form: form}


here define urls.py file where i define processor like:

 url(^xyz/$, mezzanine.pages.views.page, {Author: /xyz/}, 
name=Author),

Now it says: author is undefined. how to solve this error so form may work,

-- 
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 with page processors in Mezzanine

2014-04-01 Thread Tameen Malik


 Excellent Explanation of page processor. I was lokking for such 
 explanation from last 2 days. Good job @Eduardo -- I am trying to achieve 
 this goal too. can you please help me to solve similar 
 problem 
 https://groups.google.com/forum/#!topic/mezzanine-users/D9Gjp_jOQNM%5B1-25-false%5D
  


Looking forward to your reply 
Thank's
 

-- 
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: Cartridge shop missing from admin on deployed site

2014-04-01 Thread Ken Bolton
A colleague and I have a shorthand for caching issues: cashews. Holding
down the shift key during a reload generally bypasses the cache.
https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache

best,
ken


On Tue, Apr 1, 2014 at 1:55 AM, Jesse Carrigan
jesse.m.carri...@gmail.comwrote:

 Looks like this was a caching issue on the browser. After going into
 Chrome dev tools and disabling the cache, the shop information showed up in
 the admin.

 --
 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] Page in admin panel

2014-04-01 Thread Paullo
Hi,

I've created modules that work as expected but I'm using the django way. 
I would like to use the Mezzanine way instead (Mainly to avoid having to 
create mobile templates..) but it doesn't show up in the admin panel. The 
docs state that inheriting from PageAdmin will only allow it to be added as 
a page rather than editable in the admin panel. How would I get the 
equivalent functionality using the Page model?

Here's the original django:-

*models.py:*

from django.db import models
from django.utils import timezone
from django.forms import ValidationError

from mezzanine.core.models import Displayable, Ownable, RichText
from mezzanine.utils.models import AdminThumbMixin
from mezzanine.conf import settings

from phookit.apps.geocoders.models import Geocoder


def get_future_events():
today = timezone.now()
return Event.objects.filter(event_date__gte=today)

def get_expired_events(age_days):
if( not age_days ):
return []

today = timezone.now()
maxAge = timezone.now() - timezone.timedelta(days=age_days)
return 
Event.objects.filter(event_date__gte=maxAge).exclude(event_date__gte=today).order_by(-event_date,-start_time)


class Event(Displayable, Ownable, RichText, AdminThumbMixin, Geocoder):
event_date = models.DateField()
start_time = models.TimeField()
end_time = models.TimeField()

class Meta:
verbose_name = Event
verbose_name_plural = Events
ordering = (event_date,start_time)


@models.permalink
def get_absolute_url(self):
url_name = events:detail
kwargs = {event_id: self.id}
return (url_name, (), kwargs)


*admin.py:*
from copy import deepcopy
from django.contrib import admin
from mezzanine.core.admin import DisplayableAdmin, OwnableAdmin

from .models import Event

# never show published or expiry date
eventFieldsets = deepcopy(DisplayableAdmin.fieldsets)
eventFieldsets[0][1][fields].remove( ('publish_date', 'expiry_date') )


class EventAdmin(DisplayableAdmin, OwnableAdmin):

fieldsets = (
deepcopy(eventFieldsets[0]),
(Event details,{
'fields': ('address', 'content', 'event_date', ('start_time', 
'end_time'), 'mappable_location', ('lat', 'lon'))
}),
deepcopy(eventFieldsets[1]),
)

def save_form(self, request, form, change):

Super class ordering is important here - user must get saved first.

OwnableAdmin.save_form(self, request, form, change)
return DisplayableAdmin.save_form(self, request, form, change)

admin.site.register(Event, EventAdmin)


And the stripped down Mezzanine way which isn't available in the control 
panel:


*models.py*
from django.db import models
from mezzanine.pages.models import Page
from mezzanine.pages.models import RichText

class Event(Page, RichText):
event_date = models.DateField(Event date)   
start_time = models.TimeField(Event start time)
end_time = models.TimeField(Event end time)


*admin.py*
from django.contrib import 
admin
from mezzanine.pages.admin import 
PageAdmin 
from .models import Event



admin.site.register(Event, PageAdmin)

Cheers in advance




-- 
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] Where to define Proccessor_for.py

2014-04-01 Thread Josh Cartmell
Don't modify any of the Mezzanine code directly.  You need to create an app
of your own, add it to INSTALLED_APPS and inside of that app create a
page_processors.py file.  After that it will be automatically picked up.


On Mon, Mar 31, 2014 at 10:47 PM, Tameen Malik tame...@gmail.com wrote:

 All i have to do is to add this mezzanine.pages.views.page  line in
 views.py file?

 --
 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: What to do next?

2014-04-01 Thread Josh Cartmell
I'm not sure, are you getting an error message?


On Tue, Apr 1, 2014 at 1:21 AM, Tameen Malik tame...@gmail.com wrote:


 *urls.py*

 urlpatterns += patterns('',
 url(r'^/xyz/$', create_Book))


  --
 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: Page Processors are not working!

2014-04-01 Thread Josh Cartmell
Is author a model in one of your apps?

TO be effective with Mezzanine you need to have a good understanding of
Django, I would suggest going through the Django tutorial,
https://docs.djangoproject.com/en/1.7/intro/tutorial01/


On Tue, Apr 1, 2014 at 3:35 AM, Tameen Malik tame...@gmail.com wrote:

 url(^xyz/$, mezzanine.pages.views.page, {slug: Author},
  name=Author), this line solves error and showing page but form still
 doesn't display. why ? :(

 --
 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] Page in admin panel

2014-04-01 Thread Josh Cartmell
Hey Paullo, at this point if you go to Content - Pages in the admin you
should be able to choose Event in the Add dropdown.  What sort of
functionality are you looking for?


On Tue, Apr 1, 2014 at 7:05 AM, Paullo paul.c.h...@gmail.com wrote:

 Hi,

 I've created modules that work as expected but I'm using the django way.
 I would like to use the Mezzanine way instead (Mainly to avoid having to
 create mobile templates..) but it doesn't show up in the admin panel. The
 docs state that inheriting from PageAdmin will only allow it to be added as
 a page rather than editable in the admin panel. How would I get the
 equivalent functionality using the Page model?

 Here's the original django:-

 *models.py:*

 from django.db import models
 from django.utils import timezone
 from django.forms import ValidationError

 from mezzanine.core.models import Displayable, Ownable, RichText
 from mezzanine.utils.models import AdminThumbMixin
 from mezzanine.conf import settings

 from phookit.apps.geocoders.models import Geocoder


 def get_future_events():
 today = timezone.now()
 return Event.objects.filter(event_date__gte=today)

 def get_expired_events(age_days):
 if( not age_days ):
 return []

 today = timezone.now()
 maxAge = timezone.now() - timezone.timedelta(days=age_days)
 return
 Event.objects.filter(event_date__gte=maxAge).exclude(event_date__gte=today).order_by(-event_date,-start_time)


 class Event(Displayable, Ownable, RichText, AdminThumbMixin, Geocoder):
 event_date = models.DateField()
 start_time = models.TimeField()
 end_time = models.TimeField()

 class Meta:
 verbose_name = Event
 verbose_name_plural = Events
 ordering = (event_date,start_time)


 @models.permalink
 def get_absolute_url(self):
 url_name = events:detail
 kwargs = {event_id: self.id}
 return (url_name, (), kwargs)


 *admin.py:*
 from copy import deepcopy
 from django.contrib import admin
 from mezzanine.core.admin import DisplayableAdmin, OwnableAdmin

 from .models import Event

 # never show published or expiry date
 eventFieldsets = deepcopy(DisplayableAdmin.fieldsets)
 eventFieldsets[0][1][fields].remove( ('publish_date', 'expiry_date') )


 class EventAdmin(DisplayableAdmin, OwnableAdmin):

 fieldsets = (
 deepcopy(eventFieldsets[0]),
 (Event details,{
 'fields': ('address', 'content', 'event_date', ('start_time',
 'end_time'), 'mappable_location', ('lat', 'lon'))
 }),
 deepcopy(eventFieldsets[1]),
 )

 def save_form(self, request, form, change):
 
 Super class ordering is important here - user must get saved first.
 
 OwnableAdmin.save_form(self, request, form, change)
 return DisplayableAdmin.save_form(self, request, form, change)

 admin.site.register(Event, EventAdmin)


 And the stripped down Mezzanine way which isn't available in the control
 panel:


 *models.py*
 from django.db import models
 from mezzanine.pages.models import Page
 from mezzanine.pages.models import RichText

 class Event(Page, RichText):
 event_date = models.DateField(Event date)
 start_time = models.TimeField(Event start time)
 end_time = models.TimeField(Event end time)


 *admin.py*
 from django.contrib import
 admin
 from mezzanine.pages.admin import
 PageAdmin
 from .models import Event


 admin.site.register(Event, PageAdmin)

 Cheers in advance




  --
 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: Page Processors are not working!

2014-04-01 Thread Tameen Malik


 Yes author is model @Josh

 

 Thank's Allah, i solve this problem.   What i did is i decided to start 
 from simple model and simple example.


*models.py file:*
 

 from django.db import models
 from mezzanine.pages.models import Page

 class Author(Page):
 dob = models.DateField(Date of birth)


*page_processors.py file:*

from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from models import Author

@processor_for(authors)
def authors_list(request, page):
   authors =['abc', 'def']   //just hard coded 
these values to get better understanding for myself
   return {authors: authors} 

*authors.html page*

html
head
titlePage Title/title
/head

body

{% for item in authors %}
{{ item}}br /
{% endfor %}

/body
/html

*urls.py file:*

url(^authors/$, mezzanine.pages.views.page, {slug: authors}, 
name=authors),


Thank's Mezzanine Users
Regards 
Tameen

-- 
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: Page Processors are not working!

2014-04-01 Thread Josh Cartmell
Great, I'm glad you worked it out ;)


On Tue, Apr 1, 2014 at 9:20 AM, Tameen Malik tame...@gmail.com wrote:

 Yes author is model @Josh



 Thank's Allah, i solve this problem.   What i did is i decided to start
 from simple model and simple example.


 *models.py file:*


 from django.db import models
 from mezzanine.pages.models import Page

 class Author(Page):
 dob = models.DateField(Date of birth)


 *page_processors.py file:*

 from django.http import HttpResponseRedirect
 from mezzanine.pages.page_processors import processor_for
 from models import Author

 @processor_for(authors)
 def authors_list(request, page):
authors =['abc', 'def']   //just hard coded
 these values to get better understanding for myself
return {authors: authors}

 *authors.html page*

 html
 head
 titlePage Title/title
 /head

 body

 {% for item in authors %}
 {{ item}}br /
 {% endfor %}

 /body
 /html

 *urls.py file:*

 url(^authors/$, mezzanine.pages.views.page, {slug: authors},
 name=authors),


 Thank's Mezzanine Users
 Regards
 Tameen

 --
 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] Page in admin panel

2014-04-01 Thread Josh Cartmell
Hey Paul, I would probably have Events subclass Displayable rather than
page.  Page's are good for static content that belong in the menus, but not
so good for content that has some sort of natural order (like dates for
events).

I would look at how Mezzanine's BlogPosts work and do something similar.


On Tue, Apr 1, 2014 at 9:30 AM, Paullo paul.c.h...@gmail.com wrote:

 Hi Josh,

 I currently have a single Events page which I can add individual events
 too. When I change it to use the Mezzanine way I can only add events as
 separate pages. I'm missing something :)

 Paul



 On Tuesday, 1 April 2014 17:09:48 UTC+1, Josh Cartmell wrote:

 Hey Paullo, at this point if you go to Content - Pages in the admin you
 should be able to choose Event in the Add dropdown.  What sort of
 functionality are you looking for?


 On Tue, Apr 1, 2014 at 7:05 AM, Paullo paul@gmail.com wrote:

  Hi,

 I've created modules that work as expected but I'm using the django
 way. I would like to use the Mezzanine way instead (Mainly to avoid
 having to create mobile templates..) but it doesn't show up in the admin
 panel. The docs state that inheriting from PageAdmin will only allow it to
 be added as a page rather than editable in the admin panel. How would I get
 the equivalent functionality using the Page model?

 Here's the original django:-

 *models.py:*

 from django.db import models
 from django.utils import timezone
 from django.forms import ValidationError

 from mezzanine.core.models import Displayable, Ownable, RichText
 from mezzanine.utils.models import AdminThumbMixin
 from mezzanine.conf import settings

 from phookit.apps.geocoders.models import Geocoder


 def get_future_events():
 today = timezone.now()
 return Event.objects.filter(event_date__gte=today)

 def get_expired_events(age_days):
 if( not age_days ):
 return []

 today = timezone.now()
 maxAge = timezone.now() - timezone.timedelta(days=age_days)
 return Event.objects.filter(event_date__gte=maxAge).exclude(
 event_date__gte=today).order_by(-event_date,-start_time)


 class Event(Displayable, Ownable, RichText, AdminThumbMixin, Geocoder):
 event_date = models.DateField()
 start_time = models.TimeField()
 end_time = models.TimeField()

 class Meta:
 verbose_name = Event
 verbose_name_plural = Events
 ordering = (event_date,start_time)


 @models.permalink
 def get_absolute_url(self):
 url_name = events:detail
 kwargs = {event_id: self.id}
 return (url_name, (), kwargs)


 *admin.py:*
 from copy import deepcopy
 from django.contrib import admin
 from mezzanine.core.admin import DisplayableAdmin, OwnableAdmin

 from .models import Event

 # never show published or expiry date
 eventFieldsets = deepcopy(DisplayableAdmin.fieldsets)
 eventFieldsets[0][1][fields].remove( ('publish_date', 'expiry_date') )


 class EventAdmin(DisplayableAdmin, OwnableAdmin):

 fieldsets = (
 deepcopy(eventFieldsets[0]),
 (Event details,{
 'fields': ('address', 'content', 'event_date',
 ('start_time', 'end_time'), 'mappable_location', ('lat', 'lon'))
 }),
 deepcopy(eventFieldsets[1]),
 )

 def save_form(self, request, form, change):
 
 Super class ordering is important here - user must get saved
 first.
 
 OwnableAdmin.save_form(self, request, form, change)
 return DisplayableAdmin.save_form(self, request, form, change)

 admin.site.register(Event, EventAdmin)


 And the stripped down Mezzanine way which isn't available in the
 control panel:


 *models.py*
 from django.db import models
 from mezzanine.pages.models import Page
 from mezzanine.pages.models import RichText

 class Event(Page, RichText):
 event_date = models.DateField(Event date)
 start_time = models.TimeField(Event start time)
 end_time = models.TimeField(Event end time)


 *admin.py*
 from django.contrib import admin

 from mezzanine.pages.admin import PageAdmin

 from .models import Event


 admin.site.register(Event, PageAdmin)

 Cheers in advance




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

Re: [mezzanine-users] Page in admin panel

2014-04-01 Thread Paullo
Cool, thanks Josh.

Paul


On Tuesday, 1 April 2014 17:55:00 UTC+1, Josh Cartmell wrote:

 Hey Paul, I would probably have Events subclass Displayable rather than 
 page.  Page's are good for static content that belong in the menus, but not 
 so good for content that has some sort of natural order (like dates for 
 events).

 I would look at how Mezzanine's BlogPosts work and do something similar.


 On Tue, Apr 1, 2014 at 9:30 AM, Paullo paul@gmail.com 
 javascript:wrote:

 Hi Josh,

 I currently have a single Events page which I can add individual events 
 too. When I change it to use the Mezzanine way I can only add events as 
 separate pages. I'm missing something :)

 Paul



 On Tuesday, 1 April 2014 17:09:48 UTC+1, Josh Cartmell wrote:

 Hey Paullo, at this point if you go to Content - Pages in the admin you 
 should be able to choose Event in the Add dropdown.  What sort of 
 functionality are you looking for?


 On Tue, Apr 1, 2014 at 7:05 AM, Paullo paul@gmail.com wrote:

  Hi,

 I've created modules that work as expected but I'm using the django 
 way. I would like to use the Mezzanine way instead (Mainly to avoid 
 having to create mobile templates..) but it doesn't show up in the admin 
 panel. The docs state that inheriting from PageAdmin will only allow it to 
 be added as a page rather than editable in the admin panel. How would I 
 get 
 the equivalent functionality using the Page model?

 Here's the original django:-

 *models.py:*

 from django.db import models
 from django.utils import timezone
 from django.forms import ValidationError

 from mezzanine.core.models import Displayable, Ownable, RichText
 from mezzanine.utils.models import AdminThumbMixin
 from mezzanine.conf import settings

 from phookit.apps.geocoders.models import Geocoder


 def get_future_events():
 today = timezone.now()
 return Event.objects.filter(event_date__gte=today)
 
 def get_expired_events(age_days):
 if( not age_days ):
 return []
 
 today = timezone.now()
 maxAge = timezone.now() - timezone.timedelta(days=age_days)
 return Event.objects.filter(event_date__gte=maxAge).exclude(
 event_date__gte=today).order_by(-event_date,-start_time)
 
 
 class Event(Displayable, Ownable, RichText, AdminThumbMixin, Geocoder):
 event_date = models.DateField()
 start_time = models.TimeField()
 end_time = models.TimeField()
 
 class Meta:
 verbose_name = Event
 verbose_name_plural = Events
 ordering = (event_date,start_time)


 @models.permalink
 def get_absolute_url(self):
 url_name = events:detail
 kwargs = {event_id: self.id}
 return (url_name, (), kwargs)


 *admin.py:*
 from copy import deepcopy
 from django.contrib import admin
 from mezzanine.core.admin import DisplayableAdmin, OwnableAdmin

 from .models import Event

 # never show published or expiry date
 eventFieldsets = deepcopy(DisplayableAdmin.fieldsets)
 eventFieldsets[0][1][fields].remove( ('publish_date', 'expiry_date') 
 )


 class EventAdmin(DisplayableAdmin, OwnableAdmin):

 fieldsets = (
 deepcopy(eventFieldsets[0]),
 (Event details,{
 'fields': ('address', 'content', 'event_date', 
 ('start_time', 'end_time'), 'mappable_location', ('lat', 'lon'))
 }),
 deepcopy(eventFieldsets[1]),
 )

 def save_form(self, request, form, change):
 
 Super class ordering is important here - user must get saved 
 first.
 
 OwnableAdmin.save_form(self, request, form, change)
 return DisplayableAdmin.save_form(self, request, form, change)

 admin.site.register(Event, EventAdmin)


 And the stripped down Mezzanine way which isn't available in the 
 control panel:


 *models.py*
 from django.db import models
 from mezzanine.pages.models import Page
 from mezzanine.pages.models import RichText

 class Event(Page, RichText):
 event_date = models.DateField(Event date)   
 start_time = models.TimeField(Event start time)
 end_time = models.TimeField(Event end time)


 *admin.py*
 from django.contrib import admin   
  

 from mezzanine.pages.admin import PageAdmin
  

 from .models import Event

  

 admin.site.register(Event, PageAdmin)

 Cheers in advance




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

Re: [mezzanine-users] Can't figure out why my Static Files won't load

2014-04-01 Thread Kyle Pennell
Hey Jesse,
Thanks for looking over this.

Ok, so you had to change it to an actual domain then?  Did you do the whole 
DNS redirect and everything to setup that domain with your digital ocean IP?

On Monday, March 31, 2014 11:58:43 PM UTC-6, Jesse Carrigan wrote:

 Rather than the IP address of the host, have you tried your live hostname 
 (e.g. www.example.com or example.com)? My sites are hosted on Digital 
 Ocean and that's what needed to be in the ALLOWED_HOSTS list. Same for the 
 server_name in the ngnix configs.


-- 
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: Tried 3-4 heroku deployment tutorials but stuck on each one.

2014-04-01 Thread Josh Cartmell
Hey Kyle, I was also struggling getting things going on Digital Ocean
earlier in the week.  I just wrote up a blog post on deploying to it:
http://bitofpixels.com/blog/deploying-mezzanine-to-digital-ocean-using-the-included-fabfile/

Following those steps works for me, hopefully it helps!


On Tue, Apr 1, 2014 at 9:39 AM, Kyle Pennell kpenn...@gmail.com wrote:

 Nice of you to come post here, Ben. Thanks.

 I've been trying with Digital Ocean now but am stuck in new and different
 interesting ways.

 Never thought deploying Mezzanine would take me 25+ hours.  This is
 probably more my fault than the tutorials I've been using.  But wow.  Ouch.


 On Sunday, March 30, 2014 1:32:30 PM UTC-6, Ben Havilland wrote:

 Hi all,
 I just joined the group.  Kyle, it appears you have moved on but if
 anybody else is needs the current working Mezzanine/Heroku setup I've
 updated my tutorial and it addresses/fixes KeyError: u'ENGINE' the error
 you were getting.

 I just ran through it from scratch with the latest packages with success:
 http://www.benhavilland.com/blog/deploying-mezzanine-on-heroku/

 There was a problem in the settings.py with the placement of the local
 settings and dynamic settings sections in the tutorial code.

 Ben

 On Tuesday, March 25, 2014 11:36:26 AM UTC-7, Kyle Pennell wrote:

 Hey all,
 Would love to get some help here if you could.  Hit the wall on what I
 can do/try.

 I'm just trying to deploy a basic mezzanine setup on Heroku.  I've 
 triedJosh's tutorialhttps://gist.github.com/joshfinnie/4046138,
 Ben's 
 Tutorialhttp://www.benhavilland.com/blog/deploying-mezzanine-on-heroku/,
 searched Stackoverflow, here, etc.  Going on 10 hours trying.  Hit unique
 and interesting bugs on each one.

 So I'm trying Steven Elliot's tutorialhttp://stevenelliottjr.github.io/.
  I reasoned that it was the newest (15 days ago) and might work better.
  He's been extremely helpful on Twitter.

 Hit this roadblock here:

  (mezzenv)kpennell@vm-0:~/mezz-site$ python manage.py
 collectstatic

 /home/kpennell/mezz-site/mezzenv/local/lib/python2.7/
 site-packages/mezzanine/utils/conf.py:51: UserWarning: You
 haven't defined the ALLOWED_HOSTS settings, which Django 1.5 requires
 . Will fall back to the domains configured as sites.
   warn(You haven't defined the ALLOWED_HOSTS settings, which 
 /home/kpennell/mezz-site/mezzenv/local/lib/python2.7/
 site-packages/mezzanine/utils/conf.py:59: UserWarning: TIME_
 ZONE setting is not set, using closest match: Etc/UTC
   warn(TIME_ZONE setting is not set, using closest match: %s % tz)
 Traceback (most recent call last):
   File manage.py, line 29, in module
 execute_from_command_line(sys.argv)
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/core/management/__init_
 _.py, line 399, in execute_from_command_line
 utility.execute()
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/core/management/__init_
 _.py, line 392, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/core/management/__init_
 _.py, line 261, in fetch_command
 commands = get_commands()
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/core/management/__init_
 _.py, line 107, in get_commands
 apps = settings.INSTALLED_APPS
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/conf/__init__.py,
 line 54, in __getattr__
 self._setup(name)
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/conf/__init__.py, line 49, in _setup
 self._wrapped = Settings(settings_module)
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/conf/__init__.py,
 line 128, in __init__
 mod = importlib.import_module(self.SETTINGS_MODULE)
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/django/utils/importlib.py,
 line 40, in import_module
 __import__(name)
   File /home/kpennell/mezz-site/settings.py, line 442, in module
 set_dynamic_settings(globals())
   File /home/kpennell/mezz-site/mezzenv/local/lib/
 python2.7/site-packages/mezzanine/utils/conf.py,
 line 184, in set_dynamic_settings
 shortname = db[ENGINE].split(.)[-1]
 KeyError: u'ENGINE'


 So something with collect static doesn't work.  Something to do with
 set_dynamic_settings.  I copied his tut verbatim and cloned the project he
 gave me and both hit the snag there.

 I can post the code here if you want but thought pushing to github would
 be easier:

 https://github.com/kpennell/mezz-try



 Any ideas?


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

Re: [mezzanine-users] Can't figure out why my Static Files won't load

2014-04-01 Thread Jesse Carrigan
Correct, my DNS records on Digital Ocean are set up as follows (I'm faking 
some of the information here):

example.com
A record: @ 192.168.123.123
NS: NS1.DIGITALOCEAN.COM
NS: NS2.DIGITALOCEAN.COM
NS: NS3.DIGITALOCEAN.COM

example.com is in the ALLOWED_HOSTS list.

It sounds like you may not have a domain associated with the droplet, 
though? Is that the case?

-- 
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] Can't figure out why my Static Files won't load

2014-04-01 Thread Jesse Carrigan


 I don't have it on github, but it basically follows the pattern of the 
 deploy/ngnix.conf file in the mezzanine project. Here's what it looks like:

 upstream example {server 127.0.0.1:8001;}server {listen 80;listen 
 443 ssl;server_name example.com;client_max_body_size 10M;
 keepalive_timeout15;ssl_certificate  conf/example.crt;
 ssl_certificate_key  conf/example.key;ssl_session_cache
 shared:SSL:10m;ssl_session_timeout  10m;ssl_ciphers 
 RC4:HIGH:!aNULL:!MD5;ssl_prefer_server_ciphers on;location / {
 proxy_redirect  off;proxy_set_headerHost
 $host;proxy_set_headerX-Real-IP   $remote_addr;   
  proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;  
   proxy_set_headerX-Forwarded-Protocol$scheme;proxy_pass  
 http://example http://example.com/;}location /static/ {
 roothome/admin/.virtualenvs/example/project/;access_log   
off;log_not_found   off;}location /robots.txt {
 roothome/admin/.virtualenvs/example/project/static;
 access_log  off;log_not_found   off;}location 
 /favicon.ico {root
 home/admin/.virtualenvs/example/project/static/img;
 access_log  off;log_not_found   off;}}



-- 
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] Can't figure out why my Static Files won't load

2014-04-01 Thread Kyle Pennell
I'm going to try Fabric next. I was trying to the Digital Ocean Tuts to try
to get this but no dice.


On Tue, Apr 1, 2014 at 1:38 PM, Jesse Carrigan
jesse.m.carri...@gmail.comwrote:

 Just out of curiosity, are you using fabric to deploy your site or are you
 editing the config by hand?

 Also, a couple of things I found helpful in trying to get the static files
 going:

 http://blog.doismellburning.co.uk/2012/06/25/django-and-static-files/

 https://docs.djangoproject.com/en/dev/howto/static-files/

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