[mezzanine-users] File Upload in Mezzanine

2014-04-06 Thread Tameen Malik


I am unable to upload my file upload program. I created a small project in 
django to upload and download files. This project was/is working very fine. Now 
i am trying this in Mezzanine for which i have created following models:

from django.db import modelsfrom django.contrib.auth.models import Userfrom 
mezzanine.pages.models import Pagefrom time import time
def get_upload_file_name(instance, filename):
return "galleries/%s_%s" %(str(time()).replace('.','_'), filename)


GENDER = (('','Please Select ...'),('male','Male'), 
('female','Female'))class AllUsers(models.Model):
FullName = models.CharField(max_length=300)
DOB = models.DateField()
Gender = models.CharField(max_length=7, choices = GENDER)
HomeAddress = models.TextField()
Contact = models.CharField(max_length=300)
Email = models.EmailField()
CV = models.FileField(upload_to = get_upload_file_name)

forms like :

class UserForm(forms.ModelForm):
class Meta:
model = AllUsers
fields = ['FullName' ,'DOB' 
,'Gender','HomeAddress','Contact','Email','CV','UserDepartment']

Html page for form

{%csrf_token%}
 
{{id}}
Users Profile
{% fields_for form %}

{% block account_form_actions %}

{% endblock %}



Problem: I upload my file and press submit button, on submission it moves 
me to html form page and remove the file i uploaded. and ask me to upload 
file again.

-- 
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] Changes in Model

2014-04-04 Thread Tameen Malik
My model was

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

i removed dob field and updated model with:

class Author(Page):
name = models.CharField(max_length = 250)
email = models.EmailField()


Then entered two commands:

python manage.py schemamigration project_name 001_initial--add-field 
Author.name, Author.email 

then this command 

 python manage.py migrate project_name

you can see attach image : these above commands don't allow me to save 
changes in models.

Need your assistance!

-- 
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] Models are not working

2014-04-02 Thread Tameen Malik
I have created Models like

*models.py file:*
 

> from django.db import models
> from mezzanine.pages.models import Page
>
> class Author(Page):
> dob = models.DateField("Date of birth")
>


  
   I am using Wamp to save database/tables.
   My database name is abcdef

*   tables have created in my database now. but models are not working, 
tables define in models are not created.*
  
Note: I have mention "south" in my Installed Apps.

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

>
> Thank's @Josh :)
>

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



Page Title




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




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


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


[mezzanine-users] Re: Page Processors are not working!

2014-04-01 Thread Tameen Malik
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.


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


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.


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.


[mezzanine-users] Re: What to do next?

2014-04-01 Thread Tameen Malik

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


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

{% 
csrf_token %}
{{form.as_ul}}



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

2014-03-31 Thread Tameen Malik
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.


[mezzanine-users] Re: Where to define Proccessor_for.py

2014-03-31 Thread Tameen Malik
To associate a Page Processor to a custom Page model you must create the 
function for it in a module called page_processors.py inside one of your 
INSTALLED_APPS and decorate it using the decorator
mezzanine.pages.page_processors.processor_for.  I know this is the answer 
of my question. I have mentioned mezzanine.pages.page_processors.processor_for 
i my installed apps and 

from mezzanine.pages import page_processors
page_processors.autodiscover()

lines in in my urls.py file but what to do more to access this?

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

2014-03-31 Thread Tameen Malik
and how to define this in template to make this accessible?

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

2014-03-31 Thread Tameen Malik
from django import forms
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from .models import Author

This is processor.py file: Now i save this in /myproject/proccessor.py. My 
question can be simple but i am confuse that now where i have to define 
this to access this form. (in url.py file using views or in template or is 
there any other way too!)

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

-- 
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-03-31 Thread Tameen Malik

>
> Yes you are right sir!
>
hmm there are two things i am moving towards Django -cms and Mezzanine. 
Should i move to django-cms first to getbetter understanding to 
mezzanine world or both are different?

-- 
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-03-31 Thread Tameen Malik

>
> yes i studied first 5 chapters of djangobook.com this week. hmm i don't 
> know i just stuck here in mezzanine. Sir can't you give me small example 
> (if you can). Mezzanine documentation is not detailed or may be my mind 
> can't work unless i go through 3,4 examples! :(
>

-- 
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-03-31 Thread Tameen Malik

>
> Thank You!
>>
>hmmm see i have created models.py file in project have these lines:
>
> from django.db import modelsfrom mezzanine.pages.models import Pageclass 
> Author(Page):
> dob = models.DateField("Date of birth")
> class Book(models.Model):
> author = models.ForeignKey("Author")
> cover = models.ImageField(upload_to="authors")
>
> and admin.py with these:
>
> from django.contrib import adminfrom mezzanine.pages.admin import 
> PageAdminfrom .models import Author  
>
>  

> admin.site.register(Author, PageAdmin)
>
>
> Now i write these commands: python manage.py syncdb,  python manage.py 
> migrate,  
> and then open python shell to write  Author.objects.create(dob = 
> "12/12/2014")
>
> That generates error that author is not defined. It's true because no 
> tables created in my database.!
>
 

>

-- 
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-03-31 Thread Tameen Malik

>
> Thank You!
>
   hmmm see i have created models.py file in project have these lines:

from django.db import modelsfrom mezzanine.pages.models import Pageclass 
Author(Page):
dob = models.DateField("Date of birth")
class Book(models.Model):
author = models.ForeignKey("Author")
cover = models.ImageField(upload_to="authors")

and admin.py with these:

from django.contrib import adminfrom mezzanine.pages.admin import PageAdminfrom 
.models import Author
 


Now i write these commands: python manage.py syncdb,  python manage.py 
migrate,  
and then open python shell to write  Author.objects.create(dob = 
"12/12/2014")

That generates error that author is not defined. It's true because no 
tables created in my database.!

-- 
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-03-31 Thread Tameen Malik

>
> Kenneth Bolton i am still confuse with two things:
>

First Scenario: I go to http://127.0.0.1:8000/admin/ page. i log-in using 
my admin account. I go to `Pages`, add new page named `FirstPage` . This 
page has one submission form to get email id , user name etc. Now i can see 
this page in my site.This goes fine. Problem is How to get data/values 
posted in this form of FirstPage.

Second Scenario: I have created an html page using my editor. I save this 
page to my templates folder. i want to bind this page to menu of home page. 
How to do this.

My questions can similar to my first/last one's. But i am not getting my 
way that's why i need your assistance

Thank's for precious time.
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] How to set menus and to get postedata in Mezzanine Django

2014-03-31 Thread Tameen Malik

>
> Great reply.
>>
>  
>
>> Thank's Kenneth Bolton
>>
>
>   Can i ask you more question's if i face any problems further :)
>   
>   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] How to set menus and to get postedata in Mezzanine Django

2014-03-31 Thread Tameen Malik

>
> Great reply. 
>>
>  
>
>> Thank's Kenneth Bolton
>>
>
>   Can i ask you more question's if i face any problems further :)
>   
>   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] How to set menus and to get postedata in Mezzanine Django

2014-03-31 Thread Tameen Malik

>
> Great reply. 
>
 

> Thank's Kenneth Bolton
>

  Can i ask you more question's if i face any problems further :)
  
  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] How to set menus and to get postedata in Mezzanine Django

2014-03-31 Thread Tameen Malik

>
> Hi Kenneth Bolton Thank's for quick response. Few more questions:
>>
> In the admin interface for the page, look for the fields "Show in menus". 
>  -*- using admin interface if i create page i don't find this in 
> templates folder and if i create html page and store this in 
> templates/pages folder, how to show this in menu of home page?*
>  
> using 
> django.http.HttpRequest.method
>  *we return page url so that's work similar to django framework?*
>
> Thank's Looking forward to your reply :)
>
 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.


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

2014-03-31 Thread Tameen Malik


I have created a *model.py* file in which I define my classes like:

from django.db import modelsfrom mezzanine.pages.models import Page
class Author(Page):
dob = models.DateField("Date of birth")
class Book(models.Model):
author = models.ForeignKey("Author")
cover = models.ImageField(upload_to="authors")

Then my HTML page and place it into templates folder define URL in *urls.py*
 file.

I run command python manage.py collecttemplates to get all templates

Now I browse 127.0.0.1/8000/page1/ to get my page view.

Question 1: How to place this page in menu of home page using admin 
interface?

Question 2: How to solve this error 'NoneType' object has no attribute 
'split' generates if I browse http://127.0.0.1:8000/admin/conf/setting/?

question3 : How to access POST DATA from forms created in mezzanine 
interface?

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