Re: How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi Vijay Khemlani

I tried tutorial. and "error: timed out" was disappeared!

http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
was deprecated.

http://docs.celeryproject.org/en/master/django/first-steps-with-django.html
is new.

I added the code in my app/__init__.py:

---
from __future__ import absolute_import

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
---

How do I call other process?

Is it okey?

@shared_task
def my_task():
cmd = "cd program_path;python my_program.py"
import subprocess
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
return proc


I call my my_task function in the view

---
def run_celery(request):
result = my_task.delay()
while not result.ready():
print 'processing...'
print result.get()

return HttpResponse("test")


2015年1月9日金曜日 13時49分15秒 UTC+9 Sugita Shinsuke:
>
> Hi Vijay Khemlani
>
> Thank you for replying. 
>
> >Have you done the celery tutorial?
> I have not done the celery tutorial yet.
>
> But, I ran Redis and set below in my settings.py
>
> BROKER_URL = 'redis://localhost'
> CELERY_RESULT_BACKEND = 'redis'
> CELERY_TASK_SERIALIZER = 'json'
> CELERY_RESULT_SERIALIZER = 'json'
> CELERY_ACCEPT_CONTENT = ['json']
>
> I also ran celery command.
>
> celery -A app_name worker -l info 
>
>
> Is it the tutorial URL you said?
>
> http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
>
> Thank you.
>
> 2015年1月9日金曜日 13時24分25秒 UTC+9 Vijay Khemlani:
>>
>> Have you done the celery tutorial?
>>
>> Async tasks require you to have a broker (rabbitmq or something) and also 
>> to create some workers that actually execute the task.
>>
>> On Fri, Jan 9, 2015 at 12:55 AM, Sugita Shinsuke  
>> wrote:
>>
>>> Hi somecallitblues 
>>>
>>> Thank you for replying.
>>> I installed Celery 3.1.17.
>>>
>>> And, I setup 
>>>
>>> I created add method in tasks.py
>>>
>>> my tasks.py
>>> 
>>> from __future__ import absolute_import
>>>
>>> from celery import shared_task
>>>
>>>
>>> @shared_task
>>> def add(x, y):
>>> return x + y
>>> 
>>>
>>> I also called my add method from my view.
>>>
>>> hoge_view.py
>>> ---
>>> def run_celery(request):
>>> result = add.delay(3, 8)
>>> while not result.ready():
>>> print 'spam'
>>> print result.get()
>>> return HttpResponse("test")
>>> ---
>>>
>>> I called it from url.
>>>
>>> "error: timed out" was occurred.
>>>
>>> Why is it timed out? Could you help me?
>>>
>>>
>>> 2015年1月8日木曜日 19時19分20秒 UTC+9 somecallitblues:

 Look into celery. It's the best and easiest way to run bg jobs imo
 On 08/01/2015 9:10 pm, "Sugita Shinsuke"  wrote:

> Hi there.
>
> I'd like to run background application.
>
> I coded this code.
>
> I wrote the urls.py and I added in the view.
>
> def run_junix(request):
> cmd = "cd app_path;nohup python background_app.py &"
> import subprocess
> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
> stderr=subprocess.STDOUT)
>
> return HttpResponse("bg test")
>
> Is it good way? or using supervisor or, if you know the better way, 
> would you tell me?
>
> Anyone who know this matter, please help.
>
>  -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%
> 40googlegroups.com 
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/b5e2226c-9825-4409-bc91-4b97f5c0609e%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are sub

Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Zach Borboa
Mobile device could also be caching an incorrect csrf token.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a2f6a467-5530-44ec-841c-9599e66456bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: updating data in a row

2015-01-08 Thread James Schneider
What URL are you visiting and can you post the traceback?
On Jan 8, 2015 9:25 PM, "sum abiut"  wrote:

> Hi,
> I have change the URL mapping to  url(r'^update_form/(?P\d+)
> /$', 'eLeave.views.update_form'),
>
> but i am getting the error
>
> Page not found (404)
>
> any advise i am getting this error?
>
>
> cheers
>
> On Fri, Jan 9, 2015 at 3:20 PM, Vijay Khemlani  wrote:
>
>> You have two choices
>>
>> 1. Change the URL mapping and pass the "id" in the url
>>
>> url(r'^update_form/(?P\d+)/$', 'eLeave.views.update_form'),
>>
>> (then the url is something like /update_form/15/)
>>
>> 2, Change the view so that it only accepts the "request" argument
>>
>> def update_form(request):
>>
>> in that case you can pass the id in the POST body of the request
>>
>>
>> On Fri, Jan 9, 2015 at 12:50 AM, sum abiut  wrote:
>>
>>> hi James,
>>> here is the url.py
>>>
>>>url(r'^update_form/$', 'eLeave.views.update_form'),
>>>
>>>
>>>
>>> On Fri, Jan 9, 2015 at 2:19 PM, James Schneider >> > wrote:
>>>
 Looks like you aren't sending enough arguments to your view from the
 URL dispatcher. What does your urls.py look like?

 -James
 On Jan 8, 2015 6:49 PM, "sum abiut"  wrote:

>
> Hi,
> i am trying to update data in a row from an existing database but i
> keep getting this error.
>
> update_form() takes exactly 2 arguments (1 given)
>
> can someone advise what i am missing here.
>
>
> here are my code:
>
> view.py
>
> def update_form(request, id):
> if request.method == 'POST':
> a=newleave.objects.get(id=id)
> form =leave_application(request.POST, instance=a)
> if form.is_valid():
>form.save()
> return HttpResponseRedirect('successful.html')
> else:
> a=newleave.objects.get(id=id)
> form = leave_application(instance=a)
> return render_to_response('update_form.html', {'form': 
> form},context_instance=RequestContext(request))
>
> form.py
>
> class leave_application(forms.ModelForm):
> class Meta:
> model =newleave
> fields =('First_Name', 'Last_Name', 'department', 'position', 
> 'leave_type', 'Specify_details', 'start_Date', 'end_date', 
> 'total_working_days', 'username')
>
>
>
> model.py
>
> class newleave(models.Model):
> First_Name = models.CharField(max_length=45)
> Last_Name =models.CharField(max_length=45)
> department=models.CharField(max_length =45)
> position=models.CharField(max_length =45)
> leave_type =models.CharField(max_length=45)
> Specify_details=models.TextField(default="")
> start_Date =models.DateField(null=True)
> end_date=models.DateField(null=True)
> total_working_days=models.IntegerField(null=True)
> authorization =models.CharField(max_length=45)
> authorized_by=models.CharField(max_length=45,  default ="")
> remarks=models.TextField()
> authorizaion_date =models.DateField(null=True)
> Total_Leave_Left =models.IntegerField(default=20)
> username  =models.ForeignKey(User,  default =1)
> staff =models.ForeignKey(staff,  default =1)
>
> def __unicode__(self):
> return self.First_Name
>
>
>
> update_form.html
>
> {%csrf_token%}
> 
> {{form.as_table}}
> 
> 
> 
>
>
> 
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y4bFqUymcHzSC97znJxitpZvb0XEEwZVhhRm_gkyD%3DFkg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWYecZ%3DbVtQ_5geoiOG9ToHfUx1dNjfKVnA9MOxEO2OBg%40mail.gmail.com
 

Re: updating data in a row

2015-01-08 Thread sum abiut
Hi,
I have change the URL mapping to  url(r'^update_form/(?P\d+)
/$', 'eLeave.views.update_form'),

but i am getting the error

Page not found (404)

any advise i am getting this error?


cheers

On Fri, Jan 9, 2015 at 3:20 PM, Vijay Khemlani  wrote:

> You have two choices
>
> 1. Change the URL mapping and pass the "id" in the url
>
> url(r'^update_form/(?P\d+)/$', 'eLeave.views.update_form'),
>
> (then the url is something like /update_form/15/)
>
> 2, Change the view so that it only accepts the "request" argument
>
> def update_form(request):
>
> in that case you can pass the id in the POST body of the request
>
>
> On Fri, Jan 9, 2015 at 12:50 AM, sum abiut  wrote:
>
>> hi James,
>> here is the url.py
>>
>>url(r'^update_form/$', 'eLeave.views.update_form'),
>>
>>
>>
>> On Fri, Jan 9, 2015 at 2:19 PM, James Schneider 
>> wrote:
>>
>>> Looks like you aren't sending enough arguments to your view from the URL
>>> dispatcher. What does your urls.py look like?
>>>
>>> -James
>>> On Jan 8, 2015 6:49 PM, "sum abiut"  wrote:
>>>

 Hi,
 i am trying to update data in a row from an existing database but i
 keep getting this error.

 update_form() takes exactly 2 arguments (1 given)

 can someone advise what i am missing here.


 here are my code:

 view.py

 def update_form(request, id):
 if request.method == 'POST':
 a=newleave.objects.get(id=id)
 form =leave_application(request.POST, instance=a)
 if form.is_valid():
form.save()
 return HttpResponseRedirect('successful.html')
 else:
 a=newleave.objects.get(id=id)
 form = leave_application(instance=a)
 return render_to_response('update_form.html', {'form': 
 form},context_instance=RequestContext(request))

 form.py

 class leave_application(forms.ModelForm):
 class Meta:
 model =newleave
 fields =('First_Name', 'Last_Name', 'department', 'position', 
 'leave_type', 'Specify_details', 'start_Date', 'end_date', 
 'total_working_days', 'username')



 model.py

 class newleave(models.Model):
 First_Name = models.CharField(max_length=45)
 Last_Name =models.CharField(max_length=45)
 department=models.CharField(max_length =45)
 position=models.CharField(max_length =45)
 leave_type =models.CharField(max_length=45)
 Specify_details=models.TextField(default="")
 start_Date =models.DateField(null=True)
 end_date=models.DateField(null=True)
 total_working_days=models.IntegerField(null=True)
 authorization =models.CharField(max_length=45)
 authorized_by=models.CharField(max_length=45,  default ="")
 remarks=models.TextField()
 authorizaion_date =models.DateField(null=True)
 Total_Leave_Left =models.IntegerField(default=20)
 username  =models.ForeignKey(User,  default =1)
 staff =models.ForeignKey(staff,  default =1)

 def __unicode__(self):
 return self.First_Name



 update_form.html

 {%csrf_token%}
 
 {{form.as_table}}
 
 
 


 


  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAPCf-y4bFqUymcHzSC97znJxitpZvb0XEEwZVhhRm_gkyD%3DFkg%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWYecZ%3DbVtQ_5geoiOG9ToHfUx1dNjfKVnA9MOxEO2OBg%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users"

Return to the requested page after successfull @login_required by the next variable

2015-01-08 Thread Robin Lery
Suppose this is the url after
`@login_required(login_url='/accounts/required_login/')`:

http://ngoksy.com/accounts/login_required/?next=/article/

view for the login_require:


*def required_login(request):return render(request,
'required_login.html')*

I tried adding 'next', like it [here][1]:



*def required_login(request):c = {'next' :
request.GET.get('next', '/')}return render(request,
'login_required.html', c)*

But it didn't help.

I have different template for login and another template for anonymous user
which is redirected by `@login_required`.

required_login.html:
















*   Login required! You must login to view the content.{%
if form.error %}Sorry, invalid
username/password!{% endif %}{%csrf_token%}
Username:Password:*

I want to pass the `next` variable after successful login of
`login_required()`, and land into Articles page after that. How do I do
that? Please help me understand. Your help will be greatly appreciated.
Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGqds1Ex9Rrw9temyN2D7utJ0FkF7b_sTcOyO7strxt2nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi Vijay Khemlani

Thank you for replying. 

>Have you done the celery tutorial?
I have not done the celery tutorial yet.

But, I ran Redis and set below in my settings.py

BROKER_URL = 'redis://localhost'
CELERY_RESULT_BACKEND = 'redis'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']

I also ran celery command.

celery -A app_name worker -l info 


Is it the tutorial URL you said?

http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html

Thank you.

2015年1月9日金曜日 13時24分25秒 UTC+9 Vijay Khemlani:
>
> Have you done the celery tutorial?
>
> Async tasks require you to have a broker (rabbitmq or something) and also 
> to create some workers that actually execute the task.
>
> On Fri, Jan 9, 2015 at 12:55 AM, Sugita Shinsuke  > wrote:
>
>> Hi somecallitblues 
>>
>> Thank you for replying.
>> I installed Celery 3.1.17.
>>
>> And, I setup 
>>
>> I created add method in tasks.py
>>
>> my tasks.py
>> 
>> from __future__ import absolute_import
>>
>> from celery import shared_task
>>
>>
>> @shared_task
>> def add(x, y):
>> return x + y
>> 
>>
>> I also called my add method from my view.
>>
>> hoge_view.py
>> ---
>> def run_celery(request):
>> result = add.delay(3, 8)
>> while not result.ready():
>> print 'spam'
>> print result.get()
>> return HttpResponse("test")
>> ---
>>
>> I called it from url.
>>
>> "error: timed out" was occurred.
>>
>> Why is it timed out? Could you help me?
>>
>>
>> 2015年1月8日木曜日 19時19分20秒 UTC+9 somecallitblues:
>>>
>>> Look into celery. It's the best and easiest way to run bg jobs imo
>>> On 08/01/2015 9:10 pm, "Sugita Shinsuke"  wrote:
>>>
 Hi there.

 I'd like to run background application.

 I coded this code.

 I wrote the urls.py and I added in the view.

 def run_junix(request):
 cmd = "cd app_path;nohup python background_app.py &"
 import subprocess
 proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
 stderr=subprocess.STDOUT)

 return HttpResponse("bg test")

 Is it good way? or using supervisor or, if you know the better way, 
 would you tell me?

 Anyone who know this matter, please help.

  -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%
 40googlegroups.com 
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b5e2226c-9825-4409-bc91-4b97f5c0609e%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/43c0c4e6-f1d9-44b5-b306-c555ec9b9d17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to run background application via Django

2015-01-08 Thread Vijay Khemlani
Have you done the celery tutorial?

Async tasks require you to have a broker (rabbitmq or something) and also
to create some workers that actually execute the task.

On Fri, Jan 9, 2015 at 12:55 AM, Sugita Shinsuke  wrote:

> Hi somecallitblues
>
> Thank you for replying.
> I installed Celery 3.1.17.
>
> And, I setup
>
> I created add method in tasks.py
>
> my tasks.py
> 
> from __future__ import absolute_import
>
> from celery import shared_task
>
>
> @shared_task
> def add(x, y):
> return x + y
> 
>
> I also called my add method from my view.
>
> hoge_view.py
> ---
> def run_celery(request):
> result = add.delay(3, 8)
> while not result.ready():
> print 'spam'
> print result.get()
> return HttpResponse("test")
> ---
>
> I called it from url.
>
> "error: timed out" was occurred.
>
> Why is it timed out? Could you help me?
>
>
> 2015年1月8日木曜日 19時19分20秒 UTC+9 somecallitblues:
>>
>> Look into celery. It's the best and easiest way to run bg jobs imo
>> On 08/01/2015 9:10 pm, "Sugita Shinsuke"  wrote:
>>
>>> Hi there.
>>>
>>> I'd like to run background application.
>>>
>>> I coded this code.
>>>
>>> I wrote the urls.py and I added in the view.
>>>
>>> def run_junix(request):
>>> cmd = "cd app_path;nohup python background_app.py &"
>>> import subprocess
>>> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
>>> stderr=subprocess.STDOUT)
>>>
>>> return HttpResponse("bg test")
>>>
>>> Is it good way? or using supervisor or, if you know the better way,
>>> would you tell me?
>>>
>>> Anyone who know this matter, please help.
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b5e2226c-9825-4409-bc91-4b97f5c0609e%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei2ktiVr9w5YLN1sBND%3Dzp1vpWeEDa6H_BMpTyAXToy3iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pulling data from two table

2015-01-08 Thread sum abiut
Hi Vijay,

Thanks very much for your assistance and recommendation. i will get back to
you if needed more help.

Sum

On Fri, Jan 9, 2015 at 3:15 PM, Vijay Khemlani  wrote:

> Well, you can do something like this
>
> one_leave = leave.objects.get(pk=1) # Asuming there is a leave with pk 1
> print one_leave.staff.First_Name# Automatically joins with the staff
> table to print the first name of the associated staff
>
> Or something like this
>
> one_staff = staff.objects.get(pk=1) # Asuming there is a staff with pk 1
> staff_leaves = one_staff.leave_set.all()
> for staff_leave in staff_leaves:
> print staff leaves# Print all the leaves of a
> particular staff
>
> Also, I recommend you to follow Python and Django naming conventions, that
> is classes in CamelCase ("Staff" and "Leave" instead of "staff" and
> "leave") and fields in underscore (first_name instead of First_Name, etc)
>
> On Thu, Jan 8, 2015 at 11:41 PM, sum abiut  wrote:
>
>> Hi,
>> i am trying to pull out all the information in both model. i can pull out
>> information in each table but i am a but confuse in joining the two tables
>> together. something like NATURAL JOIN in mysql.
>>
>> Cheers,
>>
>>
>> On Fri, Jan 9, 2015 at 12:07 PM, Vijay Khemlani 
>> wrote:
>>
>>> OK, what query are you trying to make? or what information do you want
>>> to display?
>>>
>>> On Thu, Jan 8, 2015 at 6:50 PM, sum abiut  wrote:
>>>
 Hi Vijay,
 Thank you for your email. Here is my models. i want to be able to pull
 out all the data from both table and display them. i am a bit new to django
 still finding my way out.


 class staff(models.Model):
 First_Name = models.CharField(max_length=45)
 Last_Name =models.CharField(max_length=45)
 employee_Date=models.DateField()
 position=models.CharField(max_length =45)
 department=models.CharField(max_length =45)
 qualification=models.CharField(max_length =45)
 VNPF_no =models.CharField(max_length =45)
 salary =models.IntegerField()
 montly_salary=models.IntegerField()
 Training=models.TextField()
 username  =models.ForeignKey(User, default =1)

 def __unicode__(self):
 return self.First_Name

 class leave(models.Model):
 leave_type =models.CharField(max_length=45)
 Specify_details=models.TextField(default="")
 start_Date =models.DateField()
 end_date=models.DateField()
 total_working_days=models.IntegerField()
 authorization =models.CharField(max_length=45)
 authorized_by=models.CharField(max_length=45,  default ="")
 remarks=models.TextField()
 authorizaion_date =models.DateField()
 username  =models.ForeignKey(User,  default =1)
 staff =models.ForeignKey(staff,  default =1)

 def __unicode__(self):
 return self.leave_type





 On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani 
 wrote:

> Please be more specific in your question, how are these tables
> related? what models are they associated with?
>
> On Thu, Jan 8, 2015 at 6:01 PM, sum abiut  wrote:
>
>> Hi,
>> can someone please help. i am trying to pull data from two table in
>> django and display the results. can someone please point me to the right
>> direction.
>>
>> kind regards,
>> Sum A
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com
> 

Re: updating data in a row

2015-01-08 Thread Vijay Khemlani
You have two choices

1. Change the URL mapping and pass the "id" in the url

url(r'^update_form/(?P\d+)/$', 'eLeave.views.update_form'),

(then the url is something like /update_form/15/)

2, Change the view so that it only accepts the "request" argument

def update_form(request):

in that case you can pass the id in the POST body of the request


On Fri, Jan 9, 2015 at 12:50 AM, sum abiut  wrote:

> hi James,
> here is the url.py
>
>url(r'^update_form/$', 'eLeave.views.update_form'),
>
>
>
> On Fri, Jan 9, 2015 at 2:19 PM, James Schneider 
> wrote:
>
>> Looks like you aren't sending enough arguments to your view from the URL
>> dispatcher. What does your urls.py look like?
>>
>> -James
>> On Jan 8, 2015 6:49 PM, "sum abiut"  wrote:
>>
>>>
>>> Hi,
>>> i am trying to update data in a row from an existing database but i keep
>>> getting this error.
>>>
>>> update_form() takes exactly 2 arguments (1 given)
>>>
>>> can someone advise what i am missing here.
>>>
>>>
>>> here are my code:
>>>
>>> view.py
>>>
>>> def update_form(request, id):
>>> if request.method == 'POST':
>>> a=newleave.objects.get(id=id)
>>> form =leave_application(request.POST, instance=a)
>>> if form.is_valid():
>>>form.save()
>>> return HttpResponseRedirect('successful.html')
>>> else:
>>> a=newleave.objects.get(id=id)
>>> form = leave_application(instance=a)
>>> return render_to_response('update_form.html', {'form': 
>>> form},context_instance=RequestContext(request))
>>>
>>> form.py
>>>
>>> class leave_application(forms.ModelForm):
>>> class Meta:
>>> model =newleave
>>> fields =('First_Name', 'Last_Name', 'department', 'position', 
>>> 'leave_type', 'Specify_details', 'start_Date', 'end_date', 
>>> 'total_working_days', 'username')
>>>
>>>
>>>
>>> model.py
>>>
>>> class newleave(models.Model):
>>> First_Name = models.CharField(max_length=45)
>>> Last_Name =models.CharField(max_length=45)
>>> department=models.CharField(max_length =45)
>>> position=models.CharField(max_length =45)
>>> leave_type =models.CharField(max_length=45)
>>> Specify_details=models.TextField(default="")
>>> start_Date =models.DateField(null=True)
>>> end_date=models.DateField(null=True)
>>> total_working_days=models.IntegerField(null=True)
>>> authorization =models.CharField(max_length=45)
>>> authorized_by=models.CharField(max_length=45,  default ="")
>>> remarks=models.TextField()
>>> authorizaion_date =models.DateField(null=True)
>>> Total_Leave_Left =models.IntegerField(default=20)
>>> username  =models.ForeignKey(User,  default =1)
>>> staff =models.ForeignKey(staff,  default =1)
>>>
>>> def __unicode__(self):
>>> return self.First_Name
>>>
>>>
>>>
>>> update_form.html
>>>
>>> {%csrf_token%}
>>> 
>>> {{form.as_table}}
>>> 
>>> 
>>> 
>>>
>>>
>>> 
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPCf-y4bFqUymcHzSC97znJxitpZvb0XEEwZVhhRm_gkyD%3DFkg%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWYecZ%3DbVtQ_5geoiOG9ToHfUx1dNjfKVnA9MOxEO2OBg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y4N9abkcMuUdc0hET7cACLRObKaa5

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
Well, you can do something like this

one_leave = leave.objects.get(pk=1) # Asuming there is a leave with pk 1
print one_leave.staff.First_Name# Automatically joins with the staff
table to print the first name of the associated staff

Or something like this

one_staff = staff.objects.get(pk=1) # Asuming there is a staff with pk 1
staff_leaves = one_staff.leave_set.all()
for staff_leave in staff_leaves:
print staff leaves# Print all the leaves of a
particular staff

Also, I recommend you to follow Python and Django naming conventions, that
is classes in CamelCase ("Staff" and "Leave" instead of "staff" and
"leave") and fields in underscore (first_name instead of First_Name, etc)

On Thu, Jan 8, 2015 at 11:41 PM, sum abiut  wrote:

> Hi,
> i am trying to pull out all the information in both model. i can pull out
> information in each table but i am a but confuse in joining the two tables
> together. something like NATURAL JOIN in mysql.
>
> Cheers,
>
>
> On Fri, Jan 9, 2015 at 12:07 PM, Vijay Khemlani 
> wrote:
>
>> OK, what query are you trying to make? or what information do you want to
>> display?
>>
>> On Thu, Jan 8, 2015 at 6:50 PM, sum abiut  wrote:
>>
>>> Hi Vijay,
>>> Thank you for your email. Here is my models. i want to be able to pull
>>> out all the data from both table and display them. i am a bit new to django
>>> still finding my way out.
>>>
>>>
>>> class staff(models.Model):
>>> First_Name = models.CharField(max_length=45)
>>> Last_Name =models.CharField(max_length=45)
>>> employee_Date=models.DateField()
>>> position=models.CharField(max_length =45)
>>> department=models.CharField(max_length =45)
>>> qualification=models.CharField(max_length =45)
>>> VNPF_no =models.CharField(max_length =45)
>>> salary =models.IntegerField()
>>> montly_salary=models.IntegerField()
>>> Training=models.TextField()
>>> username  =models.ForeignKey(User, default =1)
>>>
>>> def __unicode__(self):
>>> return self.First_Name
>>>
>>> class leave(models.Model):
>>> leave_type =models.CharField(max_length=45)
>>> Specify_details=models.TextField(default="")
>>> start_Date =models.DateField()
>>> end_date=models.DateField()
>>> total_working_days=models.IntegerField()
>>> authorization =models.CharField(max_length=45)
>>> authorized_by=models.CharField(max_length=45,  default ="")
>>> remarks=models.TextField()
>>> authorizaion_date =models.DateField()
>>> username  =models.ForeignKey(User,  default =1)
>>> staff =models.ForeignKey(staff,  default =1)
>>>
>>> def __unicode__(self):
>>> return self.leave_type
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani 
>>> wrote:
>>>
 Please be more specific in your question, how are these tables related?
 what models are they associated with?

 On Thu, Jan 8, 2015 at 6:01 PM, sum abiut  wrote:

> Hi,
> can someone please help. i am trying to pull data from two table in
> django and display the results. can someone please point me to the right
> direction.
>
> kind regards,
> Sum A
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, s

Re: How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi somecallitblues 

Thank you for replying.
I installed Celery 3.1.17.

And, I setup 

I created add method in tasks.py

my tasks.py

from __future__ import absolute_import

from celery import shared_task


@shared_task
def add(x, y):
return x + y


I also called my add method from my view.

hoge_view.py
---
def run_celery(request):
result = add.delay(3, 8)
while not result.ready():
print 'spam'
print result.get()
return HttpResponse("test")
---

I called it from url.

"error: timed out" was occurred.

Why is it timed out? Could you help me?


2015年1月8日木曜日 19時19分20秒 UTC+9 somecallitblues:
>
> Look into celery. It's the best and easiest way to run bg jobs imo
> On 08/01/2015 9:10 pm, "Sugita Shinsuke" > 
> wrote:
>
>> Hi there.
>>
>> I'd like to run background application.
>>
>> I coded this code.
>>
>> I wrote the urls.py and I added in the view.
>>
>> def run_junix(request):
>> cmd = "cd app_path;nohup python background_app.py &"
>> import subprocess
>> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
>> stderr=subprocess.STDOUT)
>>
>> return HttpResponse("bg test")
>>
>> Is it good way? or using supervisor or, if you know the better way, would 
>> you tell me?
>>
>> Anyone who know this matter, please help.
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b5e2226c-9825-4409-bc91-4b97f5c0609e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: updating data in a row

2015-01-08 Thread sum abiut
hi James,
here is the url.py

   url(r'^update_form/$', 'eLeave.views.update_form'),



On Fri, Jan 9, 2015 at 2:19 PM, James Schneider 
wrote:

> Looks like you aren't sending enough arguments to your view from the URL
> dispatcher. What does your urls.py look like?
>
> -James
> On Jan 8, 2015 6:49 PM, "sum abiut"  wrote:
>
>>
>> Hi,
>> i am trying to update data in a row from an existing database but i keep
>> getting this error.
>>
>> update_form() takes exactly 2 arguments (1 given)
>>
>> can someone advise what i am missing here.
>>
>>
>> here are my code:
>>
>> view.py
>>
>> def update_form(request, id):
>> if request.method == 'POST':
>> a=newleave.objects.get(id=id)
>> form =leave_application(request.POST, instance=a)
>> if form.is_valid():
>>form.save()
>> return HttpResponseRedirect('successful.html')
>> else:
>> a=newleave.objects.get(id=id)
>> form = leave_application(instance=a)
>> return render_to_response('update_form.html', {'form': 
>> form},context_instance=RequestContext(request))
>>
>> form.py
>>
>> class leave_application(forms.ModelForm):
>> class Meta:
>> model =newleave
>> fields =('First_Name', 'Last_Name', 'department', 'position', 
>> 'leave_type', 'Specify_details', 'start_Date', 'end_date', 
>> 'total_working_days', 'username')
>>
>>
>>
>> model.py
>>
>> class newleave(models.Model):
>> First_Name = models.CharField(max_length=45)
>> Last_Name =models.CharField(max_length=45)
>> department=models.CharField(max_length =45)
>> position=models.CharField(max_length =45)
>> leave_type =models.CharField(max_length=45)
>> Specify_details=models.TextField(default="")
>> start_Date =models.DateField(null=True)
>> end_date=models.DateField(null=True)
>> total_working_days=models.IntegerField(null=True)
>> authorization =models.CharField(max_length=45)
>> authorized_by=models.CharField(max_length=45,  default ="")
>> remarks=models.TextField()
>> authorizaion_date =models.DateField(null=True)
>> Total_Leave_Left =models.IntegerField(default=20)
>> username  =models.ForeignKey(User,  default =1)
>> staff =models.ForeignKey(staff,  default =1)
>>
>> def __unicode__(self):
>> return self.First_Name
>>
>>
>>
>> update_form.html
>>
>> {%csrf_token%}
>> 
>> {{form.as_table}}
>> 
>> 
>> 
>>
>>
>> 
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPCf-y4bFqUymcHzSC97znJxitpZvb0XEEwZVhhRm_gkyD%3DFkg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWYecZ%3DbVtQ_5geoiOG9ToHfUx1dNjfKVnA9MOxEO2OBg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y4N9abkcMuUdc0hET7cACLRObKaa53hN8BntJ9vRkpZ2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: updating data in a row

2015-01-08 Thread James Schneider
Looks like you aren't sending enough arguments to your view from the URL
dispatcher. What does your urls.py look like?

-James
On Jan 8, 2015 6:49 PM, "sum abiut"  wrote:

>
> Hi,
> i am trying to update data in a row from an existing database but i keep
> getting this error.
>
> update_form() takes exactly 2 arguments (1 given)
>
> can someone advise what i am missing here.
>
>
> here are my code:
>
> view.py
>
> def update_form(request, id):
> if request.method == 'POST':
> a=newleave.objects.get(id=id)
> form =leave_application(request.POST, instance=a)
> if form.is_valid():
>form.save()
> return HttpResponseRedirect('successful.html')
> else:
> a=newleave.objects.get(id=id)
> form = leave_application(instance=a)
> return render_to_response('update_form.html', {'form': 
> form},context_instance=RequestContext(request))
>
> form.py
>
> class leave_application(forms.ModelForm):
> class Meta:
> model =newleave
> fields =('First_Name', 'Last_Name', 'department', 'position', 
> 'leave_type', 'Specify_details', 'start_Date', 'end_date', 
> 'total_working_days', 'username')
>
>
>
> model.py
>
> class newleave(models.Model):
> First_Name = models.CharField(max_length=45)
> Last_Name =models.CharField(max_length=45)
> department=models.CharField(max_length =45)
> position=models.CharField(max_length =45)
> leave_type =models.CharField(max_length=45)
> Specify_details=models.TextField(default="")
> start_Date =models.DateField(null=True)
> end_date=models.DateField(null=True)
> total_working_days=models.IntegerField(null=True)
> authorization =models.CharField(max_length=45)
> authorized_by=models.CharField(max_length=45,  default ="")
> remarks=models.TextField()
> authorizaion_date =models.DateField(null=True)
> Total_Leave_Left =models.IntegerField(default=20)
> username  =models.ForeignKey(User,  default =1)
> staff =models.ForeignKey(staff,  default =1)
>
> def __unicode__(self):
> return self.First_Name
>
>
>
> update_form.html
>
> {%csrf_token%}
> 
> {{form.as_table}}
> 
> 
> 
>
>
> 
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y4bFqUymcHzSC97znJxitpZvb0XEEwZVhhRm_gkyD%3DFkg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWYecZ%3DbVtQ_5geoiOG9ToHfUx1dNjfKVnA9MOxEO2OBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


updating data in a row

2015-01-08 Thread sum abiut
Hi,
i am trying to update data in a row from an existing database but i keep
getting this error.

update_form() takes exactly 2 arguments (1 given)

can someone advise what i am missing here.


here are my code:

view.py

def update_form(request, id):
if request.method == 'POST':
a=newleave.objects.get(id=id)
form =leave_application(request.POST, instance=a)
if form.is_valid():
   form.save()
return HttpResponseRedirect('successful.html')
else:
a=newleave.objects.get(id=id)
form = leave_application(instance=a)
return render_to_response('update_form.html', {'form':
form},context_instance=RequestContext(request))

form.py

class leave_application(forms.ModelForm):
class Meta:
model =newleave
fields =('First_Name', 'Last_Name', 'department', 'position',
'leave_type', 'Specify_details', 'start_Date', 'end_date',
'total_working_days', 'username')



model.py

class newleave(models.Model):
First_Name = models.CharField(max_length=45)
Last_Name =models.CharField(max_length=45)
department=models.CharField(max_length =45)
position=models.CharField(max_length =45)
leave_type =models.CharField(max_length=45)
Specify_details=models.TextField(default="")
start_Date =models.DateField(null=True)
end_date=models.DateField(null=True)
total_working_days=models.IntegerField(null=True)
authorization =models.CharField(max_length=45)
authorized_by=models.CharField(max_length=45,  default ="")
remarks=models.TextField()
authorizaion_date =models.DateField(null=True)
Total_Leave_Left =models.IntegerField(default=20)
username  =models.ForeignKey(User,  default =1)
staff =models.ForeignKey(staff,  default =1)

def __unicode__(self):
return self.First_Name



update_form.html

{%csrf_token%}

{{form.as_table}}







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y4bFqUymcHzSC97znJxitpZvb0XEEwZVhhRm_gkyD%3DFkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pulling data from two table

2015-01-08 Thread sum abiut
Hi,
i am trying to pull out all the information in both model. i can pull out
information in each table but i am a but confuse in joining the two tables
together. something like NATURAL JOIN in mysql.

Cheers,


On Fri, Jan 9, 2015 at 12:07 PM, Vijay Khemlani  wrote:

> OK, what query are you trying to make? or what information do you want to
> display?
>
> On Thu, Jan 8, 2015 at 6:50 PM, sum abiut  wrote:
>
>> Hi Vijay,
>> Thank you for your email. Here is my models. i want to be able to pull
>> out all the data from both table and display them. i am a bit new to django
>> still finding my way out.
>>
>>
>> class staff(models.Model):
>> First_Name = models.CharField(max_length=45)
>> Last_Name =models.CharField(max_length=45)
>> employee_Date=models.DateField()
>> position=models.CharField(max_length =45)
>> department=models.CharField(max_length =45)
>> qualification=models.CharField(max_length =45)
>> VNPF_no =models.CharField(max_length =45)
>> salary =models.IntegerField()
>> montly_salary=models.IntegerField()
>> Training=models.TextField()
>> username  =models.ForeignKey(User, default =1)
>>
>> def __unicode__(self):
>> return self.First_Name
>>
>> class leave(models.Model):
>> leave_type =models.CharField(max_length=45)
>> Specify_details=models.TextField(default="")
>> start_Date =models.DateField()
>> end_date=models.DateField()
>> total_working_days=models.IntegerField()
>> authorization =models.CharField(max_length=45)
>> authorized_by=models.CharField(max_length=45,  default ="")
>> remarks=models.TextField()
>> authorizaion_date =models.DateField()
>> username  =models.ForeignKey(User,  default =1)
>> staff =models.ForeignKey(staff,  default =1)
>>
>> def __unicode__(self):
>> return self.leave_type
>>
>>
>>
>>
>>
>> On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani 
>> wrote:
>>
>>> Please be more specific in your question, how are these tables related?
>>> what models are they associated with?
>>>
>>> On Thu, Jan 8, 2015 at 6:01 PM, sum abiut  wrote:
>>>
 Hi,
 can someone please help. i am trying to pull data from two table in
 django and display the results. can someone please point me to the right
 direction.

 kind regards,
 Sum A


  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPCf-y7%3D2xjk0xApyXpSnqvGHogYSdf7ztqnQUJtpvXSSamntQ%40mail.gmail.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-user

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
OK, what query are you trying to make? or what information do you want to
display?

On Thu, Jan 8, 2015 at 6:50 PM, sum abiut  wrote:

> Hi Vijay,
> Thank you for your email. Here is my models. i want to be able to pull out
> all the data from both table and display them. i am a bit new to django
> still finding my way out.
>
>
> class staff(models.Model):
> First_Name = models.CharField(max_length=45)
> Last_Name =models.CharField(max_length=45)
> employee_Date=models.DateField()
> position=models.CharField(max_length =45)
> department=models.CharField(max_length =45)
> qualification=models.CharField(max_length =45)
> VNPF_no =models.CharField(max_length =45)
> salary =models.IntegerField()
> montly_salary=models.IntegerField()
> Training=models.TextField()
> username  =models.ForeignKey(User, default =1)
>
> def __unicode__(self):
> return self.First_Name
>
> class leave(models.Model):
> leave_type =models.CharField(max_length=45)
> Specify_details=models.TextField(default="")
> start_Date =models.DateField()
> end_date=models.DateField()
> total_working_days=models.IntegerField()
> authorization =models.CharField(max_length=45)
> authorized_by=models.CharField(max_length=45,  default ="")
> remarks=models.TextField()
> authorizaion_date =models.DateField()
> username  =models.ForeignKey(User,  default =1)
> staff =models.ForeignKey(staff,  default =1)
>
> def __unicode__(self):
> return self.leave_type
>
>
>
>
>
> On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani  wrote:
>
>> Please be more specific in your question, how are these tables related?
>> what models are they associated with?
>>
>> On Thu, Jan 8, 2015 at 6:01 PM, sum abiut  wrote:
>>
>>> Hi,
>>> can someone please help. i am trying to pull data from two table in
>>> django and display the results. can someone please point me to the right
>>> direction.
>>>
>>> kind regards,
>>> Sum A
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y7%3D2xjk0xApyXpSnqvGHogYSdf7ztqnQUJtpvXSSamntQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3OudzfSz6408Mt8wd7n6xXyyXdVyBdSVRLqzNuw9rCag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: running template system standalone on django 1.7.1 results in AppRegistryNotReady error

2015-01-08 Thread Oliver Willekens
Found it. That template had {% load staticfiles %} in it, which cannot be 
used in this standalone context.

Op donderdag 8 januari 2015 02:32:00 UTC+1 schreef Oliver Willekens:
>
> I'm running into a problem when I'm trying to use Django's template system 
> in a standalone application. Previously, in Django 1.4, I didn't have this 
> problem.
>
> As described at configuring the template system in standalone mode 
> ,
>  
> I first configure the settings of Django and then call one of the template 
> loaders. However, I get an AppRegistryNotReady error:
>
> In [1]: from django.conf import settings
>
> In [2]: settings.configure(**{'TEMPLATE_DIRS': 
> ('/home/oliver/projects/autodelayv3/templates',), 'TEMPLATE_LOADERS': 
> ('django.template.loaders.filesystem.Loader',)})
>
> In [3]: from django.template.loader import render_to_string
>
> In [4]: render_to_string('webform.html', {'first_name': 'Oliver'})
> ---
> AppRegistryNotReady   Traceback (most recent call last)
>  in ()
> > 1 render_to_string('webform.html', {'first_name': 'Oliver'})
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/loader.pyc
>  
> in render_to_string(template_name, dictionary, context_instance, dirs)
> 168 t = select_template(template_name, dirs)
> 169 else:
> --> 170 t = get_template(template_name, dirs)
> 171 if not context_instance:
> 172 return t.render(Context(dictionary))
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/loader.pyc
>  
> in get_template(template_name, dirs)
> 142 handling template inheritance recursively.
> 143 """
> --> 144 template, origin = find_template(template_name, dirs)
> 145 if not hasattr(template, 'render'):
> 146 # template needs to be compiled
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/loader.pyc
>  
> in find_template(name, dirs)
> 130 for loader in template_source_loaders:
> 131 try:
> --> 132 source, display_name = loader(name, dirs)
> 133 return (source, make_origin(display_name, loader, 
> name, dirs))
> 134 except TemplateDoesNotExist:
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/loader.pyc
>  
> in __call__(self, template_name, template_dirs)
>  42 
>  43 def __call__(self, template_name, template_dirs=None):
> ---> 44 return self.load_template(template_name, template_dirs)
>  45 
>  46 def load_template(self, template_name, template_dirs=None):
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/loader.pyc
>  
> in load_template(self, template_name, template_dirs)
>  48 origin = make_origin(display_name, 
> self.load_template_source, template_name, template_dirs)
>  49 try:
> ---> 50 template = get_template_from_string(source, origin, 
> template_name)
>  51 return template, None
>  52 except TemplateDoesNotExist:
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/loader.pyc
>  
> in get_template_from_string(source, origin, name)
> 154 handling template inheritance recursively.
> 155 """
> --> 156 return Template(source, origin, name)
> 157 
> 158 
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/base.pyc
>  
> in __init__(self, template_string, origin, name)
> 130 if settings.TEMPLATE_DEBUG and origin is None:
> 131 origin = StringOrigin(template_string)
> --> 132 self.nodelist = compile_string(template_string, origin)
> 133 self.name = name
> 134 self.origin = origin
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/base.pyc
>  
> in compile_string(template_string, origin)
> 160 lexer = lexer_class(template_string, origin)
> 161 parser = parser_class(lexer.tokenize())
> --> 162 return parser.parse()
> 163 
> 164 
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/base.pyc
>  
> in parse(self, parse_until)
> 288 self.invalid_block_tag(token, command, 
> parse_until)
> 289 try:
> --> 290 compiled_result = compile_func(self, token)
> 291 except TemplateSyntaxError as e:
> 292 if not self.compile_function_error(token, e):
>
> /home/oliver/.virtualenvs/base/local/lib/python2.7/site-packages/django/template/defaulttags.pyc
>  
> in load(parser, token)
>1113 # add the library to the parser
>1114  

Re: Unable to install django on ubuntu 12.04

2015-01-08 Thread sum abiut
Its permission issue. you need to login  as root and then try install again.

enjoy,
Sum

On Fri, Jan 9, 2015 at 8:21 AM, Alex Mandel 
wrote:

> On 01/08/2015 12:06 PM, nitin katyal wrote:
> > As per the Django installation guide, I have installed pip using "sudo
> > apt-get install python-pip". Pip got installed and upgraded successfully,
> > but when I was installing Django using  "pip install django==1.7", the
> > following error appeared:
> >
> > "error: could not create '/usr/local/lib/python2.7/dist-packages/django':
> > Permission denied"
> >
> > I am a novice, please help me install django.
> >
> > Thanks in advance!
> >
>
> That command attempts to install Django for the systemwide python. On
> ubuntu this would require sudo(root) priveleges.
>
> sudo pip install django
>
> While that will work, I suspect most people would recommend you use
> python virtualenv in order to create python sandboxes. The biggest
> benefit is that you can have multiple django versions, each in their own
> sandbox (great for testing and upgrades).
>
> Here's a tutorial
>
> http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/
>
> Enjoy,
> Alex
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/54AEF4F2.9090509%40wildintellect.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y5Z95oT1BKfC%2B_z_wmQfU9GPK5BVkGk%3D%3DacE7esZrZ0eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pulling data from two table

2015-01-08 Thread sum abiut
Hi Vijay,
Thank you for your email. Here is my models. i want to be able to pull out
all the data from both table and display them. i am a bit new to django
still finding my way out.


class staff(models.Model):
First_Name = models.CharField(max_length=45)
Last_Name =models.CharField(max_length=45)
employee_Date=models.DateField()
position=models.CharField(max_length =45)
department=models.CharField(max_length =45)
qualification=models.CharField(max_length =45)
VNPF_no =models.CharField(max_length =45)
salary =models.IntegerField()
montly_salary=models.IntegerField()
Training=models.TextField()
username  =models.ForeignKey(User, default =1)

def __unicode__(self):
return self.First_Name

class leave(models.Model):
leave_type =models.CharField(max_length=45)
Specify_details=models.TextField(default="")
start_Date =models.DateField()
end_date=models.DateField()
total_working_days=models.IntegerField()
authorization =models.CharField(max_length=45)
authorized_by=models.CharField(max_length=45,  default ="")
remarks=models.TextField()
authorizaion_date =models.DateField()
username  =models.ForeignKey(User,  default =1)
staff =models.ForeignKey(staff,  default =1)

def __unicode__(self):
return self.leave_type





On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani  wrote:

> Please be more specific in your question, how are these tables related?
> what models are they associated with?
>
> On Thu, Jan 8, 2015 at 6:01 PM, sum abiut  wrote:
>
>> Hi,
>> can someone please help. i am trying to pull data from two table in
>> django and display the results. can someone please point me to the right
>> direction.
>>
>> kind regards,
>> Sum A
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y7%3D2xjk0xApyXpSnqvGHogYSdf7ztqnQUJtpvXSSamntQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
Please be more specific in your question, how are these tables related?
what models are they associated with?

On Thu, Jan 8, 2015 at 6:01 PM, sum abiut  wrote:

> Hi,
> can someone please help. i am trying to pull data from two table in django
> and display the results. can someone please point me to the right direction.
>
> kind regards,
> Sum A
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to install django on ubuntu 12.04

2015-01-08 Thread Alex Mandel
On 01/08/2015 12:06 PM, nitin katyal wrote:
> As per the Django installation guide, I have installed pip using "sudo 
> apt-get install python-pip". Pip got installed and upgraded successfully, 
> but when I was installing Django using  "pip install django==1.7", the 
> following error appeared:
> 
> "error: could not create '/usr/local/lib/python2.7/dist-packages/django': 
> Permission denied"
> 
> I am a novice, please help me install django.
> 
> Thanks in advance!
> 

That command attempts to install Django for the systemwide python. On
ubuntu this would require sudo(root) priveleges.

sudo pip install django

While that will work, I suspect most people would recommend you use
python virtualenv in order to create python sandboxes. The biggest
benefit is that you can have multiple django versions, each in their own
sandbox (great for testing and upgrades).

Here's a tutorial
http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/

Enjoy,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54AEF4F2.9090509%40wildintellect.com.
For more options, visit https://groups.google.com/d/optout.


Pulling data from two table

2015-01-08 Thread sum abiut
Hi,
can someone please help. i am trying to pull data from two table in django
and display the results. can someone please point me to the right direction.

kind regards,
Sum A

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: what's different between {% static %} and {{ STATIC_URL}}

2015-01-08 Thread Florian Schweikert

On 2015-01-06 12:55, Andreas Kuhne wrote:

The difference is the age of the django project you are looking at. {%
load staticfiles %} the {% static %} is the current way to load and
use static files. It also has the option to do other things (like MD5
hashes for versions) automatically and should be used.


Also {% static %} works with your 500.html
As there is no context accessible if an 500 happen, {{ STATIC_URL }} is 
not available.


-- Florian

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b988a8e0735fca89751cd0f8d0ca45a3%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Unable to install django on ubuntu 12.04

2015-01-08 Thread nitin katyal
As per the Django installation guide, I have installed pip using "sudo 
apt-get install python-pip". Pip got installed and upgraded successfully, 
but when I was installing Django using  "pip install django==1.7", the 
following error appeared:

"error: could not create '/usr/local/lib/python2.7/dist-packages/django': 
Permission denied"

I am a novice, please help me install django.

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/092bb95c-cb3c-4dd9-aaae-ee3eed32c0e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model to create forms

2015-01-08 Thread Lorenzo Bernardi


Hello,

this is what _relational_ databases are built for.  if you have two
tables, one for the description of the experiment (one record per
experiment), and another for the statistics (one record per data
sample, with a foreign key to the experiment record); then fetching
the description of the experiment, plus all the related data will be
much faster, simpler, more compact and all-around more efficient than
having one table per experiment.
it looks to me that the resulting code should be more compact but more 
difficult to write and maybe too clever for me. I'm writing this code 
for someone who is not completely sure of what he really wants (I mean 
the data that should be stored in the table) and  so the code should be 
able to accept some change in the definition of the experiments without 
breaking the old data.

databases aren't flat files, use them as designed and they'll perform very well.


I agree with that. My main worry is that I'm not so familiar with 
databases and I hope I can estimate if the code will perform well in 
real condition when I'll do some limited tests.


thanks  for the information and I'll give it a try

sincerely

L.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54AEEE0B.3020408%40lpn.cnrs.fr.
For more options, visit https://groups.google.com/d/optout.


Re: Model to create forms

2015-01-08 Thread Lorenzo Bernardi

Hello,

1) there is no other approach (like creating a model on the fly, that 
is not writing in models.py. But it looks against the way django 
works) and any idea is welcomed.


Generally I've found that creating a real model to store the data is 
easiest in the long run and usually involves less programming.
It definitely looks easier for me to code a model per experiment. But 
I'm writing this app for seomeone else and I foind it will be easier to 
give to this person the opportunity to create by himself the definition 
of the experiment. Of course it means my app should be rather simple to 
make it handle this (adding or substracting field of the form or 
changing things ) without loosing the data and this is where I don't 
know if I can really program this. I'll try with a simpler version and 
look again at our advice after some tests.


2) Also keeping all the experiments data in only one table and getting 
all the information for one experiment by finding all the row with the 
same uid looks a little bit a time consuming process but for now we 
used the bureaucracy plugin for the last six month and it doesn't look 
like it is slowing down too much the response of the wiki so it might 
not be so inefficient after all. Maybe it will scale badly. Here again 
any advice is welcomed.


Databases are usually good at this sort of thing. It shouldn't be a 
problem, but might require some database tuning.



OK.
3) The data to create the form is stored in a table (as a say, like a 
recipe) and so will it be better to create the form in the views.py or 
in the template (in that case in the view I gather the field 
definitions and then in templates loops through the table and create 
the widget at that time).


Again, it's possible to do this, but it's hard. Are all of the fields 
just plain text fields, or are some choice fields?


there are some choice field, and date field but may be I can gather some 
common field in the definition of the experiment.


thanks for the information

sincerely

L.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54AEEB58.5080508%40lpn.cnrs.fr.
For more options, visit https://groups.google.com/d/optout.


Re: porting to 1.7

2015-01-08 Thread Collin Anderson
Hi,

In your INSTALLED_APPS, be sure you have 'jadeempire.smartpages' instead of 
'smartpages'.

Also, any time you refer to a view, or any other import, be sure to always 
use the "jadeempire" prefix.

Collin

On Wednesday, January 7, 2015 at 8:48:20 AM UTC-5, MikeKJ wrote:
>
> I have hit a snag and reading the relevant ticket has left me none the 
> wiser
>
> RuntimeError: Conflicting 'category' models in application 'smartpages': 
>  and  'smartpages.models.Category'>.
>
> this is the structure
>
> jade - directories( apache2, bin, jadeempire, lib
> jadeempire - directories(jadeempire) files(manage.py)
> jadeempire - directories(various apps) files(__init__.py, cp.py, 
> settings.py, urls.py, wsgi.py)
>
> >>> import sys
> >>> print(sys.path)
> ['/home/jones124/webapps/jade/jadeempire', 
> '/home/jones124/webapps/jade/lib/python2.7/Django-1.7.1-py2.7.egg', 
> '/home/jones124/webapps/jade/lib/python2.7', 
> '/home/jones124/lib/python2.7', '/usr/local/lib/python27.zip', 
> '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', 
> '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', 
> '/usr/local/lib/python2.7/lib-dynload', 
> '/usr/local/lib/python2.7/site-packages', 
> '/usr/local/lib/python2.7/site-packages/PIL']
>
> I kind of understand that that the model is being addressed twice and 
> under 1.7 that is now forbidden but where and how I do not know, any help 
> much appreciated 
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/812a0049-120a-4235-ba5b-2e6328cf2725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filter_horizontal, applying filter on the right box - chosen items

2015-01-08 Thread ebuild
This doesn't answer the question.

On Thursday, January 8, 2015 6:50:22 PM UTC+1, Collin Anderson wrote:
>
> Hi,
>
> It's a bit hacky, but I've used filter_horizontal outside of the admin 
> before.
>
> from django.contrib.admin import widgets
>
> class MyForm(forms.Form):
> users = forms.ModelMultipleChoiceField(
> required=False,
> widget=widgets.FilteredSelectMultiple(verbose_name='Field Name', 
> is_stacked=False),
> queryset=choices_qs,
> initial=initial_qs,
> )
>
> 
> function addEvent(obj, evType, fn){obj.addEventListener(evType, fn
> , false)}
> {{ form }}
> https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js";
> >
> django = {jQuery: $}
> 
> {{ form.media }}
>
> Collin
>
> On Monday, January 5, 2015 at 12:39:39 AM UTC-5, ebuild wrote:
>>
>> I'm wondering if there is a standard way to add a javascript-based filter 
>> on the right box like the one in the  left
>> when having manytomany relation with filter_horizontal.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2cf03a2d-b2b0-4f44-93b4-bb7eec3b464f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question on Template placement in file system

2015-01-08 Thread Collin Anderson
Hi,

The tutorial suggests A) (for a non-reusable app).

https://docs.djangoproject.com/en/1.7/intro/tutorial02/#ref-customizing-your-projects-templates

Collin

On Tuesday, January 6, 2015 at 10:25:10 AM UTC-5, Tobias Dacoir wrote:
>
> I have been working through the official Django 1.7 tutorial and also 
> Tango with Django but I'm confused as to where put my templates - I want to 
> follow best practices as much as possible.
> Now currently I only plan to develop a single project with a single app, 
> but I might want to include 3rd party apps later on.
> So I have created my project and started a new app inside. Since all pages 
> should use the same html template I wanted to place the base.html into the 
> project template folder. Or should I still put everything into the 
> app/template folder?
>
> Suggestion A)
> project_dir/templates/base.html
> project_dir/templates/app/index.html (extends base.html)
>
> Suggestion B)
> project_dir/app_dir/templates/base.html
> project_dir/app_dir/templates/index.html
>
> Suggestion C) (as in the tutorial)
> project_dir/app_dir/templates/base.html
> project_dir/app_dir/templates/app/index.html
>
>
> Later on when somebody goes to my website I want to show him some stuff 
> from my app on the index page already. So on http://mysite.com/ there 
> should already be content from my app, but there will also be static html 
> files like 'contact', 'impress', 'help' and so on, which I wanted to put 
> somewhere in my project folder and not within the app. But everything 
> should rely on the same base.html template so all pages use the same 
> javascript & css files. 
>
> Is there maybe another good tutorial for this available?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e1b599fd-2232-4d87-929e-1d0e3283a7c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error: No module named polls

2015-01-08 Thread Collin Anderson
Hi,

Question(question_text="que hay?", pub_date=timezone())

should be:

Question(question_text="que hay?", pub_date=timezone.now())

Collin

On Tuesday, January 6, 2015 at 9:03:32 AM UTC-5, ibes ... wrote:
>
> Hi, 
> thanks for your answer... 
> here is the path of my site, that i called "primerdjango": 
>
> C:\xampp\htdocs\primerdjango\ 
>
>inside of that folder i have: 
>
>  polls\ 
> primerdjango\ 
>db.sqlite3 
>  manage.py 
>Vista.py 
>
> then inside of - polls -  i have: 
>
> migrations\ 
> admin.py 
> admin.pyc 
> models.py 
> models.pyc 
> tests.py 
> tests.pyc 
> urls.py 
> urls.pyc 
> views.py 
> views.pyc 
> __init__.py 
> __init__.pyc 
>
> i have my python in C:\Python27\ 
>
> i notice that when i try to start my apache ( at the first time), i 
> have to erase the module mod_wsgi.so... 
> ( LoadModule wsgi_module modules/mod_wsgi.so ) 
>
> and comment that line in the httpd.conf, because that's the only way 
> that my apache run, the and i  can start my xampp and finally  run the 
> server with manage.py runserver... 
> that only happens at the first time, gradually during the day that 
> things doesn't happens again... 
>
> here is another problem: 
>
> when i try to follow the step of the tutorial 
> (https://docs.djangoproject.com/en/1.7/intro/tutorial01/) where it 
> said: 
> "from polls.models import Question, Choice" 
>
> begins other problems... 
>
> for example: 
>
> if i write  into the CMD the manage.py shell : 
> >>> q = Question(question_text="que hay?", pub_date=timezone()) 
>
> i got this message: 
>
> Traceback (most recent call last): 
>   File "", line 1, in  
> TypeError: 'module' object is not callable 
>
> and there i stuck... 
>
> my http pages looks fine, i can work with polls page, create, modify 
> and erase... 
>
> what i do wrong?? 
>
> sorry for my english, i'm extra newbie in python and django... 
>
> i hope that you could understand all that i try to explain... 
>
> THANKS A LOT AGAIN. 
>
> regards. 
> ibes. 
>
>
>
> 2015-01-05 14:33 GMT-05:00, Vijay Khemlani  >: 
> > Also make sure that there is an __init__.py file in the polls directory 
> > 
> > On Mon, Jan 5, 2015 at 12:47 PM, Xavier Ordoquy  > 
> > wrote: 
> > 
> >> Hi, 
> >> 
> >> 
> >> Le 5 janv. 2015 à 16:41, ibes ... > a 
> écrit : 
> >> 
> >> hello, 
> >> I am frustrated with django and phyton tutorial it is very difficult 
> >> i'm having a problem with the tutorial of django and python, 
> >> 
> >> am using django 1.7.1 and python 2.7 on win xp-sp3 so far it was good, 
> i 
> >> create everything without problem but in tutorial step where it says: 
> >> 
> >> https://docs.djangoproject.com/en/1.7/intro/tutorial01/ 
> >> 
> >> Once you’re in the shell, explore the *database API* 
> >> : 
> >> 
> >> i've got the message: 
> >> 
> >> C:\xampp\htdocs\primerdjango>manage.py runserver 
> >> Traceback (most recent call last): 
> >>   File "D:\xampp\htdocs\primerdjango\manage.py", line 10, in  
> >> execute_from_command_line(sys.argv) 
> >>   File 
> >> 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\managem 
> >> ent\__init__.py", line 385, in execute_from_command_line 
> >> utility.execute() 
> >>   File 
> >> 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\managem 
> >> ent\__init__.py", line 354, in execute 
> >> django.setup() 
> >>   File 
> >> 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\__init__.py" 
> >> , line 21, in setup 
> >> apps.populate(settings.INSTALLED_APPS) 
> >>   File 
> >> 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\registr 
> >> y.py", line 85, in populate 
> >> app_config = AppConfig.create(entry) 
> >>   File 
> >> 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\config. 
> >> py", line 123, in create 
> >> import_module(entry) 
> >>   File "D:\Python27\lib\importlib\__init__.py", line 37, in 
> import_module 
> >> __import__(name) 
> >> ImportError: No module named polls 
> >> 
> >> i don't know what to do can anyone help, please!!! 
> >> 
> >> sorry for my bad english… 
> >> 
> >> 
> >> It looks like Python couldn’t find the « polls » directory. 
> >> Maybe you didn’t create it or it is at the wrong location. Could you 
> >> write 
> >> us where the « polls » directory is, relating to « mysite » ? 
> >> 
> >> Regards, 
> >> Xavier Ordoquy, 
> >> Linovia. 
> >> 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups 
> >> "Django users" group. 
> >> To unsubscribe from this group and stop receiving emails from it, send 
> an 
> >> email to django-users...@googlegroups.com . 
> >> To post to this group, send email to django...@googlegroups.com 
> . 
> >> Visit this group at http://groups.google.com/group/django-users. 
> >> To view this discussion on t

Re: Model to create forms

2015-01-08 Thread Javier Guerra Giraldez
On Thu, Jan 8, 2015 at 1:03 PM, Collin Anderson  wrote:
> 2) Also keeping all the experiments data in only one table and getting all
> the information for one experiment by finding all the row with the same uid
> looks a little bit a time consuming process but for now we used the
> bureaucracy plugin for the last six month and it doesn't look like it is
> slowing down too much the response of the wiki so it might not be so
> inefficient after all. Maybe it will scale badly. Here again any advice is
> welcomed.
>
> Databases are usually good at this sort of thing. It shouldn't be a problem,
> but might require some database tuning.


this is what _relational_ databases are built for.  if you have two
tables, one for the description of the experiment (one record per
experiment), and another for the statistics (one record per data
sample, with a foreign key to the experiment record); then fetching
the description of the experiment, plus all the related data will be
much faster, simpler, more compact and all-around more efficient than
having one table per experiment.

databases aren't flat files, use them as designed and they'll perform very well.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoSM-Q1Jec_2tE4zyhwt8s0x0-jwpNZCj8mCMVfV_fsgtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-compressor/assets not working on Heroku

2015-01-08 Thread Collin Anderson
Hi,

Try this:

heroku run python manage.py collectstatic --noinput

https://devcenter.heroku.com/articles/django-assets#debugging

Collin

On Tuesday, January 6, 2015 at 6:08:17 AM UTC-5, Po Chen wrote:
>
> Hi there,
>
> I've been trying to get some automatic assets handling setup in my tiny 
> django app.
> I've tried django-compressor and django-assets, no success so far.
> Both of the libraries seem to fail to create files in the staticfiles 
> directory on Heroku.
> Both of them work locally with/without debug on.
>
> I feel like I must be missing something really trivial..
>
> Your help will be much appreciated!
>
> P.S. I created a support ticket and got an answer telling me to check in 
> the staticfiles directory,
> which is created automatically when deploying django apps (created when 
> collectstatic is run post-deploy)
> I did try committing the directory with a .keep file in it, but no success 
> either.
>
> Thanks,
> Po
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c552ef5-1e4f-460b-bfb6-3d5e28edee6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model to create forms

2015-01-08 Thread Collin Anderson
Hi,

1) there is no other approach (like creating a model on the fly, that is 
not writing in models.py. But it looks against the way django works) and 
any idea is welcomed.

Generally I've found that creating a real model to store the data is 
easiest in the long run and usually involves less programming.

2) Also keeping all the experiments data in only one table and getting all 
the information for one experiment by finding all the row with the same uid 
looks a little bit a time consuming process but for now we used the 
bureaucracy plugin for the last six month and it doesn't look like it is 
slowing down too much the response of the wiki so it might not be so 
inefficient after all. Maybe it will scale badly. Here again any advice is 
welcomed.

Databases are usually good at this sort of thing. It shouldn't be a 
problem, but might require some database tuning.

3) The data to create the form is stored in a table (as a say, like a 
recipe) and so will it be better to create the form in the views.py or in 
the template (in that case in the view I gather the field definitions and 
then in templates loops through the table and create the widget at that 
time).

Again, it's possible to do this, but it's hard. Are all of the fields just 
plain text fields, or are some choice fields?

Collin

On Monday, January 5, 2015 at 10:42:35 AM UTC-5, Lorenzo Bernardi wrote:
>
>  Hello All,
>
>   I'm rather new to django and also web and database stuff and so I might 
> not use the correct term.
>
>   i need to write an application which is a log book for experiments. The 
> purpose is to store information about various experiments on different 
> experiment to keep a trace and compute some statistics on the experiments.
>
> I have started writing one  app and creating a model for each experiments 
> but it is rather a lengthy process and I was wondering if it would be 
> possible to 
>
> 1) offer a form generator for the experiments and store the contents in a 
> table defined by a model. It can also be created programmatically (in 
> starting python manage.py shell for exemple) 
> I was thinking using formset to define this form (using 
> *django-dynamic-formset 
> *) and it will be 
> like a recipe thing ( I only need a few items textinput, textarea, date and 
> predefined lists) 
>  
> 2) use this form to fill a database of data. (the key idea here is that 
> the model for the data will just contain an uid (which will be created when 
> the form is submitted) and a datatype and a value)) the many information of 
> the forms will be stored as many rows in the database table and will be 
> connected by the uid created when the form is submitted. It might not be 
> clear but I got this idea from the bureaucracy plugin in dokuwiki.
>
> Since this looks rather advanced for my skill I was wondering if 
> 1) there is no other approach (like creating a model on the fly, that is 
> not writing in models.py. But it looks against the way django works) and 
> any idea is welcomed. 
> 2) Also keeping all the experiments data in only one table and getting all 
> the information for one experiment by finding all the row with the same uid 
> looks a little bit a time consuming process but for now we used the 
> bureaucracy plugin for the last six month and it doesn't look like it is 
> slowing down too much the response of the wiki so it might not be so 
> inefficient after all. Maybe it will scale badly. Here again any advice is 
> welcomed.
> 3) The data to create the form is stored in a table (as a say, like a 
> recipe) and so will it be better to create the form in the views.py or in 
> the template (in that case in the view I gather the field definitions and 
> then in templates loops through the table and create the widget at that 
> time).
>
> Thank for reading up to this point and if you have any suggestion or 
> pointers related to this I'll be glad to get them (I mean even if you don't 
> answer directly my questions I'm interested of new ideas).
>
> sincerely 
>
> L.
>
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c71d1723-5006-4d4b-a143-4cbcd34b43f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Expected performance of the django development server?

2015-01-08 Thread Collin Anderson
Hi Richard,

Like you've seen, the _number_ of queries often has a large effect on speed.

Also, try comparing your page load time with and without debug toolbar 
enabled. I found that DDT is slow itself :).

Collin

On Monday, January 5, 2015 at 10:19:44 AM UTC-5, Richard Brockie wrote:
>
> Hi Jani,
>
> That's a correct diagnosis. I knew Django was doing lazy loading, but 
> didn't fully understand the implications.
>
> In my case I have a filtered and ordered queryset resulting in ~400 
> records. Upon processing in the template, each was prompting a database 
> visit 3 times when outputting information: hence the ~1200 trips to the 
> database.
>
> I've added prefetch_related specifying the related models I'm working with 
> in the template.
>
> My 'slow' case has now become: 46 queries in 39 ms, Time: 506 ms: a factor 
> of 20 speed improvement.
>
> Thanks for the suggestion!
> R.
>
> On Sunday, January 4, 2015 10:09:58 PM UTC-8, Jani Tiainen wrote:
>
>> By judging amount of queries of your "slow" page you probably have 
>> model(s) with foreign keys that you lazy load - which means that each fk is 
>> loaded individually from the database with separate query. 
>>
>> For example if you have a model that contains 4 foreign keys and you 
>> query 100 instances (rows) you would actually invoke 1 + 4 * n queries, 
>> which in example case would be 401. 
>>
>> Without actually knowning your code one of the first options you usually 
>> do to optimize queries is to use select_related and prefetch_related 
>> queryset methods to cut down number of queries needed. 
>>
>> -- 
>>
>> Jani Tiainen 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb15e0ab-2f12-42c1-8971-84f3361368be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filter_horizontal, applying filter on the right box - chosen items

2015-01-08 Thread Collin Anderson
Hi,

It's a bit hacky, but I've used filter_horizontal outside of the admin 
before.

from django.contrib.admin import widgets

class MyForm(forms.Form):
users = forms.ModelMultipleChoiceField(
required=False,
widget=widgets.FilteredSelectMultiple(verbose_name='Field Name', 
is_stacked=False),
queryset=choices_qs,
initial=initial_qs,
)


function addEvent(obj, evType, fn){obj.addEventListener(evType, fn, 
false)}
{{ form }}
https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js";
>
django = {jQuery: $}

{{ form.media }}

Collin

On Monday, January 5, 2015 at 12:39:39 AM UTC-5, ebuild wrote:
>
> I'm wondering if there is a standard way to add a javascript-based filter 
> on the right box like the one in the  left
> when having manytomany relation with filter_horizontal.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d704af5e-af3d-4767-8537-439a5693c055%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Exception occurred processing WSGI script

2015-01-08 Thread Néstor
It would be nice to read about the solution to your problem :-)
On Jan 7, 2015 8:09 PM, "sarfaraz ahmed"  wrote:

> Issue resolved. Please close this
>
> On Wednesday, 7 January 2015 23:02:33 UTC+5:30, sarfaraz ahmed wrote:
>>
>> This is what I am trying to do.
>>
>> I am using amazon ec2 windows free tier and i am trying to setup django
>> on XAMPP.
>>
>> I am using apache 2.4 Windows 32 bit version
>> python 2.7.9 window 32 bit version
>> mod_wsgi 3.5 windows 32 bit version
>> and Django 1.7
>>
>> my project as nothing but just mysite project with myapp as application
>> My mod_wsgi file looks like this
>>
>> ==
>>
>> import os,sys
>> sys.path.append('c:\\xampp\\htdocs\\mysite')
>> os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'
>>
>> import django.core.handlers.wsgi
>> application= django.core.handlers.wsgi.WSGIHandler()
>>
>> =-==
>>
>>
>> +++
>> Apache error log looks horrible
>> +++
>>
>>
>> mod_wsgi (pid=1980): Exception occurred processing WSGI script
>> 'C:/xampp/htdocs/mysite/mod.wsgi'.
>> [Wed Jan 07 16:46:37.425730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] Traceback (most recent call last):
>> [Wed Jan 07 16:46:37.425730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\wsgi.py",
>> line 187, in __call__
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] response = self.get_response(request)
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py",
>> line 199, in get_response
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] response = self.handle_uncaught_exception(request,
>> resolver, sys.exc_info())
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py",
>> line 236, in handle_uncaught_exception
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return debug.technical_500_response(request, *exc_info)
>> [Wed Jan 07 16:46:37.427732 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\views\\debug.py",
>> line 91, in technical_500_response
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] html = reporter.get_traceback_html()
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\views\\debug.py",
>> line 350, in get_traceback_html
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return t.render(c)
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 148, in render
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return self._render(context)
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 142, in _render
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return self.nodelist.render(context)
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 844, in render
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] bit = self.render_node(node, context)
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\debug.py",
>> line 80, in render_node
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return node.render(context)
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\debug.py",
>> line 90, in render
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] output = self.filter_expression.resolve(context)
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 624, in resolve
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] new_obj = func(obj, *arg_vals)
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Pytho

Re: Deploying Django on Docker

2015-01-08 Thread Jeroen Bakker

Hi Anssi,

Not really an answer to your question, but just to give you insight to a 
solution.


We at l1nda are using docker and django with small applications and 
large applications.


We developed an nginx container and uwsgi container and a devops 
container. The devops container does all the tricky parts and the nginx 
and uwsgi containers are basically simple ones.


We have automated the deployment docker (devops) image that internally 
uses docker-py that will minimize the downtime of the django containers. 
The script is just a python file of 100 lines that brings application 
down and up in a redundant way it also starts the staticscollecting etc. 
As it is pulling the images from another server (at our office), the 
security hurden is small.


1. Pull new images from our private repository
2. Collect statics, update databases etc.
3. loop per container [we run every application in 4 different containers]
3.1 stop old container
3.2 start new container.

We use a shared FS (NFS) for sharing the resources (uwsgi is allowed to 
write to the FS and the nginx is only allowed to read from the FS. The 
machine that contains the nginx image is also hosting the FS.


Jeroen




On 01/08/2015 11:45 AM, Anssi Kääriäinen wrote:
For a long time I have been battling with the following problem: how 
to deploy Django in an easy, maintainable, secure and reliable way for 
small Django applications. The applications I write are mainly very 
low traffic, and often they are coded in a couple of days. 
Unfortunately the hardest part of producing these applications has 
been deployment. A big part of the problem is that I have to work with 
RHEL6 based servers, and those tend to have old libraries.


The solution I am currently using is a nice little setup helper I 
wrote, django-dockerfile: 
https://github.com/akaariai/django-dockerfile. The idea is that you 
write a environment file for each server you want to deploy into, and 
after that everything happens automatically through usage of fab.


The solution works great for me even if there is still a lot to do. 
For example, usage of the fig package could make the code more robust, 
and allow for multi-server installations.


The main reason I am writing here on django-users is that I would like 
to see an easy way to deploy small Django applications. For large 
applications it seems OK to just build up your own deployment 
strategy, but for small applications it is too easy to end up doing 
the deployment in a hackish way where for example deploying the 
application isn't scripted, and each application's deployment strategy 
varies slightly.


I am looking for a way to deploy Django with at least these features:
  - Allows one-command deployment directly from Git to Docker-enabled 
server

  - Easy to use and get started
  - Doesn't use development server, or SQLite as database.
  - Does care for security
  - Media and static files served properly (note: CDN is overkill for 
my projects!)
  - Allows one to define secrets and other environment variables per 
installation

  - Preferably: logging, backup and restore thought out

The django-dockerfile package has the above features except for 
logging, backup and restore.


So, if there already exists something that has the above features 
implemented, then please tell me. If not, I am looking for interested 
developers to participate in building a tool for the small Django 
project deployment use case. The django-dockerfile package could be 
used as basis for the work, but using some other package or just 
starting from scratch are also options. Just writing a blog post that 
has information about an example Django deployment with every aspect 
of the above feature list covered could be enough.


 - Anssi
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eeb24be3-1f3d-4d4e-8ba0-7a476871c43a%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--


*L1NDA B.V.*
*www.l1nda.nl *
*www.facebook.com/L1NDA.NL 
* Nieuwezijds Voorburgwal 101-III
1012 RG, Amsterdam
020-7526690
KvK: 57861765

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To p

Re: django form field validation and error display

2015-01-08 Thread 赵飞
I have read the doc, what you say is helpfull, thanks! 

在 2015年1月8日星期四UTC+8下午7时33分42秒,Edgar Gabaldi写道:
>
> There is not your problem, but maybe will be in future. The best way to 
> clean fields that depend of other fields is override the clean method of 
> form.
>
>
> https://docs.djangoproject.com/en/1.7/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other
>
> On Thu, Jan 8, 2015 at 9:28 AM, 赵飞 > 
> wrote:
>
> That's it!  Thanks very very much, you help me a lot!
>
> 2015-01-08 19:10 GMT+08:00 James Schneider  >:
>
> Oh, you are passing a URL to render() instead of a template name. Try 
> something like this:
>
> return render(request, 'signup.html', {'form': signup_form})
>
> Sorry, didn't catch that the first time.
>
> -James
>
>
> On Thu, Jan 8, 2015 at 1:34 AM, 赵飞 > 
> wrote:
>
> I want to make a signup page, when user click signup, it will check if the 
> two password are the same, when not, give a error message after "confirm 
> password". 
>
> But when I call "return render(request, reverse("accounts:signup"), 
> {'form': signup_form}) " in my views.py, it shows me an error, the 
> traceback is:
>
>  Environment:
>
> Request Method: POST
>Request URL: http://127.0.0.1:8000/accounts/signup_post/
>
>Django Version: 1.7
>Python Version: 2.7.5
>Installed Applications:
>('django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'accounts')
>Installed Middleware:
>('django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>Template Loader Error:
>Django tried loading these templates, in this order:
>Using loader django.template.loaders.filesystem.Loader:
>Using loader django.template.loaders.app_directories.Loader:
>
>Traceback:
>File 
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/handlers/base.py"
>  
> in get_response
>  111. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
>File "/Users/feizhao/dropbox/nahan/accounts/views.py" in signup_post
>  64. return render(request, reverse("accounts:signup"), {'form': 
> signup_form})
>File 
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/shortcuts.py"
>  
> in render
>  48. return HttpResponse(loader.render_to_string(*args, **kwargs),
>File 
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>  
> in render_to_string
>  170. t = get_template(template_name, dirs)
>File 
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>  
> in get_template
>  144. template, origin = find_template(template_name, dirs)
>File 
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>  
> in find_template
>  136. raise TemplateDoesNotExist(name)
>
>Exception Type: TemplateDoesNotExist at /accounts/signup_post/
>Exception Value: /accounts/signup/
>
> my account app looks like:
>
>$ tree -L 3 accounts
>accounts
>├── __init__.py
>├── admin.py
>├── forms.py
>├── locale
>│   └── zh_CN
>├── migrations
>│   ├── 0001_initial.py
>│   ├── __init__.py
>├── models.py
>├── static
>│   └── accounts
>│   └── login.css
>├── templates
>│   └── accounts
>│   ├── base.html
>│   ├── login.html
>│   └── signup.html
>├── tests.py
>├── urls.py
>├── views.py
>
>  urls.py:
>
> urlpatterns = patterns(
>'',
>url(r'^accounts/', include('accounts.urls', namespace="accounts")),
>url(r'^admin/', include(admin.site.urls)),
>)
>
> accounts/urls.py:
>
> urlpatterns = patterns(
>'',
>url(r'^login/$', views.login, name='login'),
>url(r'^signup/$', views.signup, name='signup'),
>url(r'^login_post/$', views.login_post, name='login_post'),
>url(r'^signup_post/$', views.signup_post, name='signup_post'),
>)
>
> signup_post function in views.py: 
>
> def signup_post(request):
>if request.method == 'POST':
>signup_form = forms.SignupForm(request.POST)
>
>if signup_form.is_valid():
>signup_info = signup_form.cleaned_data
>username = signup_info['username']
>email = signup_info['email']
>password = signup_info['password_1']
>user = User.objects

Re: django form field validation and error display

2015-01-08 Thread Edgar Gabaldi
There is not your problem, but maybe will be in future. The best way to
clean fields that depend of other fields is override the clean method of
form.

https://docs.djangoproject.com/en/1.7/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other

On Thu, Jan 8, 2015 at 9:28 AM, 赵飞  wrote:

> That's it!  Thanks very very much, you help me a lot!
>
> 2015-01-08 19:10 GMT+08:00 James Schneider :
>
>> Oh, you are passing a URL to render() instead of a template name. Try
>> something like this:
>>
>> return render(request, 'signup.html', {'form': signup_form})
>>
>> Sorry, didn't catch that the first time.
>>
>> -James
>>
>>
>> On Thu, Jan 8, 2015 at 1:34 AM, 赵飞  wrote:
>>
>>> I want to make a signup page, when user click signup, it will check if
>>> the two password are the same, when not, give a error message after
>>> "confirm password".
>>>
>>> But when I call "return render(request, reverse("accounts:signup"),
>>> {'form': signup_form}) " in my views.py, it shows me an error, the
>>> traceback is:
>>>
>>>  Environment:
>>>
>>> Request Method: POST
>>>Request URL: http://127.0.0.1:8000/accounts/signup_post/
>>>
>>>Django Version: 1.7
>>>Python Version: 2.7.5
>>>Installed Applications:
>>>('django.contrib.admin',
>>> 'django.contrib.auth',
>>> 'django.contrib.contenttypes',
>>> 'django.contrib.sessions',
>>> 'django.contrib.messages',
>>> 'django.contrib.staticfiles',
>>> 'accounts')
>>>Installed Middleware:
>>>('django.contrib.sessions.middleware.SessionMiddleware',
>>> 'django.middleware.common.CommonMiddleware',
>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>>
>>>Template Loader Error:
>>>Django tried loading these templates, in this order:
>>>Using loader django.template.loaders.filesystem.Loader:
>>>Using loader django.template.loaders.app_directories.Loader:
>>>
>>>Traceback:
>>>File
>>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/handlers/base.py"
>>> in get_response
>>>  111. response = wrapped_callback(request,
>>> *callback_args, **callback_kwargs)
>>>File "/Users/feizhao/dropbox/nahan/accounts/views.py" in signup_post
>>>  64. return render(request, reverse("accounts:signup"), {'form':
>>> signup_form})
>>>File
>>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/shortcuts.py"
>>> in render
>>>  48. return HttpResponse(loader.render_to_string(*args,
>>> **kwargs),
>>>File
>>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>>> in render_to_string
>>>  170. t = get_template(template_name, dirs)
>>>File
>>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>>> in get_template
>>>  144. template, origin = find_template(template_name, dirs)
>>>File
>>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>>> in find_template
>>>  136. raise TemplateDoesNotExist(name)
>>>
>>>Exception Type: TemplateDoesNotExist at /accounts/signup_post/
>>>Exception Value: /accounts/signup/
>>>
>>> my account app looks like:
>>>
>>>$ tree -L 3 accounts
>>>accounts
>>>├── __init__.py
>>>├── admin.py
>>>├── forms.py
>>>├── locale
>>>│   └── zh_CN
>>>├── migrations
>>>│   ├── 0001_initial.py
>>>│   ├── __init__.py
>>>├── models.py
>>>├── static
>>>│   └── accounts
>>>│   └── login.css
>>>├── templates
>>>│   └── accounts
>>>│   ├── base.html
>>>│   ├── login.html
>>>│   └── signup.html
>>>├── tests.py
>>>├── urls.py
>>>├── views.py
>>>
>>>  urls.py:
>>>
>>> urlpatterns = patterns(
>>>'',
>>>url(r'^accounts/', include('accounts.urls', namespace="accounts"
>>> )),
>>>url(r'^admin/', include(admin.site.urls)),
>>>)
>>>
>>> accounts/urls.py:
>>>
>>> urlpatterns = patterns(
>>>'',
>>>url(r'^login/$', views.login, name='login'),
>>>url(r'^signup/$', views.signup, name='signup'),
>>>url(r'^login_post/$', views.login_post, name='login_post'),
>>>url(r'^signup_post/$', views.signup_post, name='signup_post'),
>>>)
>>>
>>> signup_post function in views.py:
>>>
>>> def signup_post(request):
>>>if request.method == 'POST':
>>>signup_form = forms.SignupForm(request.POST)
>>>
>>>if signup_form.is_valid():
>>>signup_info = signup_form.cleaned_data
>>>username = signup_info['username']
>>>email = signup_info['email']
>>>   

Re: django form field validation and error display

2015-01-08 Thread 赵飞
That's it!  Thanks very very much, you help me a lot!

2015-01-08 19:10 GMT+08:00 James Schneider :

> Oh, you are passing a URL to render() instead of a template name. Try
> something like this:
>
> return render(request, 'signup.html', {'form': signup_form})
>
> Sorry, didn't catch that the first time.
>
> -James
>
>
> On Thu, Jan 8, 2015 at 1:34 AM, 赵飞  wrote:
>
>> I want to make a signup page, when user click signup, it will check if
>> the two password are the same, when not, give a error message after
>> "confirm password".
>>
>> But when I call "return render(request, reverse("accounts:signup"),
>> {'form': signup_form}) " in my views.py, it shows me an error, the
>> traceback is:
>>
>>  Environment:
>>
>> Request Method: POST
>>Request URL: http://127.0.0.1:8000/accounts/signup_post/
>>
>>Django Version: 1.7
>>Python Version: 2.7.5
>>Installed Applications:
>>('django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 'accounts')
>>Installed Middleware:
>>('django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware',
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>
>>Template Loader Error:
>>Django tried loading these templates, in this order:
>>Using loader django.template.loaders.filesystem.Loader:
>>Using loader django.template.loaders.app_directories.Loader:
>>
>>Traceback:
>>File
>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/handlers/base.py"
>> in get_response
>>  111. response = wrapped_callback(request,
>> *callback_args, **callback_kwargs)
>>File "/Users/feizhao/dropbox/nahan/accounts/views.py" in signup_post
>>  64. return render(request, reverse("accounts:signup"), {'form':
>> signup_form})
>>File
>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/shortcuts.py"
>> in render
>>  48. return HttpResponse(loader.render_to_string(*args, **kwargs),
>>File
>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>> in render_to_string
>>  170. t = get_template(template_name, dirs)
>>File
>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>> in get_template
>>  144. template, origin = find_template(template_name, dirs)
>>File
>> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
>> in find_template
>>  136. raise TemplateDoesNotExist(name)
>>
>>Exception Type: TemplateDoesNotExist at /accounts/signup_post/
>>Exception Value: /accounts/signup/
>>
>> my account app looks like:
>>
>>$ tree -L 3 accounts
>>accounts
>>├── __init__.py
>>├── admin.py
>>├── forms.py
>>├── locale
>>│   └── zh_CN
>>├── migrations
>>│   ├── 0001_initial.py
>>│   ├── __init__.py
>>├── models.py
>>├── static
>>│   └── accounts
>>│   └── login.css
>>├── templates
>>│   └── accounts
>>│   ├── base.html
>>│   ├── login.html
>>│   └── signup.html
>>├── tests.py
>>├── urls.py
>>├── views.py
>>
>>  urls.py:
>>
>> urlpatterns = patterns(
>>'',
>>url(r'^accounts/', include('accounts.urls', namespace="accounts"
>> )),
>>url(r'^admin/', include(admin.site.urls)),
>>)
>>
>> accounts/urls.py:
>>
>> urlpatterns = patterns(
>>'',
>>url(r'^login/$', views.login, name='login'),
>>url(r'^signup/$', views.signup, name='signup'),
>>url(r'^login_post/$', views.login_post, name='login_post'),
>>url(r'^signup_post/$', views.signup_post, name='signup_post'),
>>)
>>
>> signup_post function in views.py:
>>
>> def signup_post(request):
>>if request.method == 'POST':
>>signup_form = forms.SignupForm(request.POST)
>>
>>if signup_form.is_valid():
>>signup_info = signup_form.cleaned_data
>>username = signup_info['username']
>>email = signup_info['email']
>>password = signup_info['password_1']
>>user = User.objects.create_user(
>>username=username,
>>email=email,
>>password=password)
>>user.save()
>>
>>else:
>>signup_form = forms.SignupForm()
>>
>>return render(request, reverse("accounts:signup"), {'form':
>> signup_form})
>>
>> I have read [Django TemplateDoesNotExist][1] and other simi

Re: Deploying Django on Docker

2015-01-08 Thread Mike Dewhirst

On 8/01/2015 9:45 PM, Anssi Kääriäinen wrote:

For a long time I have been battling with the following problem: how to
deploy Django in an easy, maintainable, secure and reliable way for
small Django applications. The applications I write are mainly very low
traffic, and often they are coded in a couple of days. Unfortunately the
hardest part of producing these applications has been deployment. A big
part of the problem is that I have to work with RHEL6 based servers, and
those tend to have old libraries.

The solution I am currently using is a nice little setup helper I wrote,
django-dockerfile: https://github.com/akaariai/django-dockerfile. The
idea is that you write a environment file for each server you want to
deploy into, and after that everything happens automatically through
usage of fab.


Have you seen Mezzanine fab deployment? Ken Bolton has blogged about it ...

http://bscientific.org/blog/mezzanine-fabric-git-vagrant-joy/

Mike




The solution works great for me even if there is still a lot to do. For
example, usage of the fig package could make the code more robust, and
allow for multi-server installations.

The main reason I am writing here on django-users is that I would like
to see an easy way to deploy small Django applications. For large
applications it seems OK to just build up your own deployment strategy,
but for small applications it is too easy to end up doing the deployment
in a hackish way where for example deploying the application isn't
scripted, and each application's deployment strategy varies slightly.

I am looking for a way to deploy Django with at least these features:
   - Allows one-command deployment directly from Git to Docker-enabled
server
   - Easy to use and get started
   - Doesn't use development server, or SQLite as database.
   - Does care for security
   - Media and static files served properly (note: CDN is overkill for
my projects!)
   - Allows one to define secrets and other environment variables per
installation
   - Preferably: logging, backup and restore thought out

The django-dockerfile package has the above features except for logging,
backup and restore.

So, if there already exists something that has the above features
implemented, then please tell me. If not, I am looking for interested
developers to participate in building a tool for the small Django
project deployment use case. The django-dockerfile package could be used
as basis for the work, but using some other package or just starting
from scratch are also options. Just writing a blog post that has
information about an example Django deployment with every aspect of the
above feature list covered could be enough.

  - Anssi

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
.
To post to this group, send email to django-users@googlegroups.com
.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/eeb24be3-1f3d-4d4e-8ba0-7a476871c43a%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54AE67E5.3050704%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: django form field validation and error display

2015-01-08 Thread James Schneider
Oh, you are passing a URL to render() instead of a template name. Try
something like this:

return render(request, 'signup.html', {'form': signup_form})

Sorry, didn't catch that the first time.

-James


On Thu, Jan 8, 2015 at 1:34 AM, 赵飞  wrote:

> I want to make a signup page, when user click signup, it will check if the
> two password are the same, when not, give a error message after "confirm
> password".
>
> But when I call "return render(request, reverse("accounts:signup"),
> {'form': signup_form}) " in my views.py, it shows me an error, the
> traceback is:
>
>  Environment:
>
> Request Method: POST
>Request URL: http://127.0.0.1:8000/accounts/signup_post/
>
>Django Version: 1.7
>Python Version: 2.7.5
>Installed Applications:
>('django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'accounts')
>Installed Middleware:
>('django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>Template Loader Error:
>Django tried loading these templates, in this order:
>Using loader django.template.loaders.filesystem.Loader:
>Using loader django.template.loaders.app_directories.Loader:
>
>Traceback:
>File
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/handlers/base.py"
> in get_response
>  111. response = wrapped_callback(request,
> *callback_args, **callback_kwargs)
>File "/Users/feizhao/dropbox/nahan/accounts/views.py" in signup_post
>  64. return render(request, reverse("accounts:signup"), {'form':
> signup_form})
>File
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/shortcuts.py"
> in render
>  48. return HttpResponse(loader.render_to_string(*args, **kwargs),
>File
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
> in render_to_string
>  170. t = get_template(template_name, dirs)
>File
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
> in get_template
>  144. template, origin = find_template(template_name, dirs)
>File
> "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
> in find_template
>  136. raise TemplateDoesNotExist(name)
>
>Exception Type: TemplateDoesNotExist at /accounts/signup_post/
>Exception Value: /accounts/signup/
>
> my account app looks like:
>
>$ tree -L 3 accounts
>accounts
>├── __init__.py
>├── admin.py
>├── forms.py
>├── locale
>│   └── zh_CN
>├── migrations
>│   ├── 0001_initial.py
>│   ├── __init__.py
>├── models.py
>├── static
>│   └── accounts
>│   └── login.css
>├── templates
>│   └── accounts
>│   ├── base.html
>│   ├── login.html
>│   └── signup.html
>├── tests.py
>├── urls.py
>├── views.py
>
>  urls.py:
>
> urlpatterns = patterns(
>'',
>url(r'^accounts/', include('accounts.urls', namespace="accounts")),
>url(r'^admin/', include(admin.site.urls)),
>)
>
> accounts/urls.py:
>
> urlpatterns = patterns(
>'',
>url(r'^login/$', views.login, name='login'),
>url(r'^signup/$', views.signup, name='signup'),
>url(r'^login_post/$', views.login_post, name='login_post'),
>url(r'^signup_post/$', views.signup_post, name='signup_post'),
>)
>
> signup_post function in views.py:
>
> def signup_post(request):
>if request.method == 'POST':
>signup_form = forms.SignupForm(request.POST)
>
>if signup_form.is_valid():
>signup_info = signup_form.cleaned_data
>username = signup_info['username']
>email = signup_info['email']
>password = signup_info['password_1']
>user = User.objects.create_user(
>username=username,
>email=email,
>password=password)
>user.save()
>
>else:
>signup_form = forms.SignupForm()
>
>return render(request, reverse("accounts:signup"), {'form':
> signup_form})
>
> I have read [Django TemplateDoesNotExist][1] and other similar questions,
> but no help!
>
>   [1]:
> https://stackoverflow.com/questions/4765003/django-templatedoesnotexist
>
> 在 2015年1月7日星期三UTC+8下午10时03分09秒,赵飞写道:
>
>> I want to make a signup page just like:
>>
>>
>> 

Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Abraham Varricatt
Can it be possible that you are rendering a different template (without 
CSRF) for the mobile version?

-Abraham V.


On Thursday, January 8, 2015 2:15:21 PM UTC+5:30, Sugita Shinsuke wrote:
>
> Hello Vijay Khemlani 
>
> Thank you for replying.
> But, of cause I appended the tag in my form like below
>
> 
> {% csrf_token %}
>
> but I wonder about that using the iframe is bad.
>
> The form is child of iframe.
>
> I also checked Chrome's developer tool.
> The csrf token was saved in the cookie.
>
> 2015年1月6日火曜日 23時00分10秒 UTC+9 Vijay Khemlani:
>>
>> ¿Did you include de {% csrf_token %} tag in the form? ¿Is it generating 
>> the corresponding hidden input tag in the html?
>>
>> On Tue, Jan 6, 2015 at 6:09 AM, Sugita Shinsuke  
>> wrote:
>>
>>> Hello.
>>>
>>> When I use Django via my smart phone Android and iOS.
>>> The error sometimes occurred.
>>>
>>> Forbidden (403)
>>> CSRF verification failed. Request aborted.
>>> Help
>>> Reason given for failure:
>>> CSRF token missing or incorrect.
>>>
>>> In general, this can occur when there is a genuine Cross Site Request 
>>> Forgery, or when Django's CSRF mechanism has not been used correctly. For 
>>> POST forms, you need to ensure:
>>> Your browser is accepting cookies.
>>> The view function uses RequestContext for the template, instead of 
>>> Context.
>>> In the template, there is a {% csrf_token %} template tag inside each 
>>> POST form that targets an internal URL.
>>> If you are not using CsrfViewMiddleware, then you must use csrf_protect 
>>> on any views that use the csrf_token template tag, as well as those that 
>>> accept the POST data.
>>> You're seeing the help section of this page because you have DEBUG = 
>>> True in your Django settings file. Change that to False, and only the 
>>> initial error message will be displayed.
>>> You can customize this page using the CSRF_FAILURE_VIEW setting.
>>>
>>> I append django.middleware.csrf.CsrfViewMiddleware', of 
>>> MIDDLEWARE_CLASSES in settings.py
>>>
>>> I use
>>> Python 2.7.5
>>> Django 1.6.4
>>>
>>> Anyone who know this matter, please help.
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/e0db1d43-8897-40fc-be1d-65c76d9da503%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3697e749-4cbe-483f-b820-a5d71509287e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django on Docker

2015-01-08 Thread Guilherme Leal
Honestly, i dont have the time to participate on this project right now,
but i would use a tool like this for small projects. FOR SURE.

Em Thu Jan 08 2015 at 08:45:56, Anssi Kääriäinen 
escreveu:

For a long time I have been battling with the following problem: how to
> deploy Django in an easy, maintainable, secure and reliable way for small
> Django applications. The applications I write are mainly very low traffic,
> and often they are coded in a couple of days. Unfortunately the hardest
> part of producing these applications has been deployment. A big part of the
> problem is that I have to work with RHEL6 based servers, and those tend to
> have old libraries.
>
> The solution I am currently using is a nice little setup helper I wrote,
> django-dockerfile: https://github.com/akaariai/django-dockerfile. The
> idea is that you write a environment file for each server you want to
> deploy into, and after that everything happens automatically through usage
> of fab.
>
> The solution works great for me even if there is still a lot to do. For
> example, usage of the fig package could make the code more robust, and
> allow for multi-server installations.
>
> The main reason I am writing here on django-users is that I would like to
> see an easy way to deploy small Django applications. For large applications
> it seems OK to just build up your own deployment strategy, but for small
> applications it is too easy to end up doing the deployment in a hackish way
> where for example deploying the application isn't scripted, and each
> application's deployment strategy varies slightly.
>
> I am looking for a way to deploy Django with at least these features:
>   - Allows one-command deployment directly from Git to Docker-enabled
> server
>   - Easy to use and get started
>   - Doesn't use development server, or SQLite as database.
>   - Does care for security
>   - Media and static files served properly (note: CDN is overkill for my
> projects!)
>   - Allows one to define secrets and other environment variables per
> installation
>   - Preferably: logging, backup and restore thought out
>
> The django-dockerfile package has the above features except for logging,
> backup and restore.
>
> So, if there already exists something that has the above features
> implemented, then please tell me. If not, I am looking for interested
> developers to participate in building a tool for the small Django project
> deployment use case. The django-dockerfile package could be used as basis
> for the work, but using some other package or just starting from scratch
> are also options. Just writing a blog post that has information about an
> example Django deployment with every aspect of the above feature list
> covered could be enough.
>
>  - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/eeb24be3-1f3d-4d4e-8ba0-7a476871c43a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOs3Lp43K3NoSL7VYN4Y_CcMoDPM3xgn5MHWS5w64XrKESQU5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread James Schneider
After a bit of reflection, I actually think the 'telnet' test would be a
good one to run before troubleshooting your code any further. Many ISP's
block port 25 going out to the Internet because that is the default port
used for SMTP communication between SMTP servers to relay mail. Spammers
use this port to directly send mail to remote servers, hence the reason it
is blocked. I would try 587 as an alternative, as it appears your mail
provider offers it. You may still need to set EMAIL_USE_TLS to False for it
to work though. If you run the 'telnet mail.pep.co.ir 25' test and it comes
back with 'connection refused' or just seems to hang without displaying the
"220 CMS5...", then the alternate port will likely be (at least part of)
your solution.

Sorry to get so far down into the technical muck, but these are the things
that I would be trying in your situation.

-James

On Thu, Jan 8, 2015 at 2:33 AM, James Schneider 
wrote:

> Thanks.
>
> I can see from the traceback that you have EMAIL_USE_TLS set to True, but
> you also have EMAIL_PORT set to 25. It doesn't appear that your email
> server supports TLS via port 25:
>
> $ openssl s_client -starttls smtp -connect mail.pep.co.ir:25
> CONNECTED(0003)
> didn't found starttls in server response, try anyway...
> 
>
> I checked the other standard ports (tcp/465 and tcp/587) and they don't
> seem to offer SSL/TLS encryption either. I wouldn't necessarily recommend
> setting EMAIL_USE_TLS to False, although you could instead set
> EMAIL_USE_SSL to True and see if that works for you.
>
> My guess is that your SMTP host does not support any sort of encrypted
> connection. I would check their documentation to see if that is the case.
> You can also check your (working) email client settings (assuming you are
> using the same SMTP server) to see if any SSL/TLS settings are enabled. If
> neither SSL or TLS are enabled in your client (which I suspect is the case
> unless you are using MAPI/RPC via MS Outlook/Exchange), then you may
> consider setting EMAIL_USE_TLS to False and re-run the test. Note that this
> will send your password across the Internet in clear text (unless the
> server is using CRAM-MD5 for challenge/response authentication, but still
> not a great idea). You could potentially change your SMTP password
> temporarily when you disable EMAIL_USE_TLS and change it back afterwards to
> be safe. If there is no encryption set in your email client, I wouldn't
> worry about changing the password since your email client is probably
> sending it out every 10 minutes anyway.
>
> When you say 'python shell' do you mean an actual Python shell (ie. just
> typing python and manually importing the send_mail function) or are you
> starting a Python shell via 'python manage.py shell'? If you are using a
> vanilla python shell (no manage.py), the send_mail function may be relying
> on defaults since it won't take into account your settings.py file (which
> may try to relay through a local SMTP server on localhost, I haven't
> looked). If you are starting it through the manage.py shell, then I'm not
> sure where to go from there other than twiddling the settings I mentioned.
>
> Does the traceback come back immediately when you execute the view, or
> does it seem like it needs a fair amount of time to 'time out' (several
> seconds or probably more)? If it is the former, we're probably still
> looking at a DNS problem, if it is the latter, my guess is the
> EMAIL_USE_TLS variable being set to True.
>
> Since you have shell access, you could also potentially test the
> connection directly using the command:
>
> $ telnet mail.pep.co.ir 25
> Trying 79.175.161.174... Connected to mail.pep.co.ir. Escape character is
> '^]'. 220 CMS5 HighMail ESMTP Service, Version: 2008.8.0.0.4 ready at Thu,
> 8 Jan 2015 13:55:59 +0330 ehlo pep.co.ir 250-CMS5 says hello 250-DSN
> 250-AUTH LOGIN CRAM-MD5 250-AUTH=LOGIN 250 ok
>
> I typed 'ehlo pep.co.ir' after the initial connection to show the various
> authentication schemes and operations offered by the SMTP server. Just type
> quit to exit. If you do test it, as long as you get the "220 CMS5 HighMail
> ESMTP..." line, you should be in good shape. Normally I would expect to see
> "250-STARTTLS" as one of the options (indicating TLS is supported).
>
> Another option would be to try using the IP rather than the name for
> EMAIL_HOST. In this case it would be '79.175.161.174' from your nslookup
> command earlier. This 'should' bypass the DNS query to resolve the
> EMAIL_HOST to an IP address (since it is already an IP). If that works,
> then you definitely have some kind of DNS issue.
>
> -James
>
>
>
> On Thu, Jan 8, 2015 at 1:14 AM, Hossein Rashnoo  wrote:
>
>> Thank you for your reply, it seems that every thing is ok:
>> $ nslookup mail.pep.co.ir 
>>
>> Server: 10.252.84.50
>> Address:10.252.84.50#53
>>
>> Non-authoritative answer:
>> Name:   mail.pep.co.ir
>> Address: 79.175.161.174
>>
>>
>> and:
>>

Deploying Django on Docker

2015-01-08 Thread Anssi Kääriäinen
For a long time I have been battling with the following problem: how to 
deploy Django in an easy, maintainable, secure and reliable way for small 
Django applications. The applications I write are mainly very low traffic, 
and often they are coded in a couple of days. Unfortunately the hardest 
part of producing these applications has been deployment. A big part of the 
problem is that I have to work with RHEL6 based servers, and those tend to 
have old libraries.

The solution I am currently using is a nice little setup helper I wrote, 
django-dockerfile: https://github.com/akaariai/django-dockerfile. The idea 
is that you write a environment file for each server you want to deploy 
into, and after that everything happens automatically through usage of fab.

The solution works great for me even if there is still a lot to do. For 
example, usage of the fig package could make the code more robust, and 
allow for multi-server installations.

The main reason I am writing here on django-users is that I would like to 
see an easy way to deploy small Django applications. For large applications 
it seems OK to just build up your own deployment strategy, but for small 
applications it is too easy to end up doing the deployment in a hackish way 
where for example deploying the application isn't scripted, and each 
application's deployment strategy varies slightly.

I am looking for a way to deploy Django with at least these features:
  - Allows one-command deployment directly from Git to Docker-enabled server
  - Easy to use and get started
  - Doesn't use development server, or SQLite as database.
  - Does care for security
  - Media and static files served properly (note: CDN is overkill for my 
projects!)
  - Allows one to define secrets and other environment variables per 
installation
  - Preferably: logging, backup and restore thought out

The django-dockerfile package has the above features except for logging, 
backup and restore.

So, if there already exists something that has the above features 
implemented, then please tell me. If not, I am looking for interested 
developers to participate in building a tool for the small Django project 
deployment use case. The django-dockerfile package could be used as basis 
for the work, but using some other package or just starting from scratch 
are also options. Just writing a blog post that has information about an 
example Django deployment with every aspect of the above feature list 
covered could be enough.

 - Anssi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eeb24be3-1f3d-4d4e-8ba0-7a476871c43a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread James Schneider
Thanks.

I can see from the traceback that you have EMAIL_USE_TLS set to True, but
you also have EMAIL_PORT set to 25. It doesn't appear that your email
server supports TLS via port 25:

$ openssl s_client -starttls smtp -connect mail.pep.co.ir:25
CONNECTED(0003)
didn't found starttls in server response, try anyway...


I checked the other standard ports (tcp/465 and tcp/587) and they don't
seem to offer SSL/TLS encryption either. I wouldn't necessarily recommend
setting EMAIL_USE_TLS to False, although you could instead set
EMAIL_USE_SSL to True and see if that works for you.

My guess is that your SMTP host does not support any sort of encrypted
connection. I would check their documentation to see if that is the case.
You can also check your (working) email client settings (assuming you are
using the same SMTP server) to see if any SSL/TLS settings are enabled. If
neither SSL or TLS are enabled in your client (which I suspect is the case
unless you are using MAPI/RPC via MS Outlook/Exchange), then you may
consider setting EMAIL_USE_TLS to False and re-run the test. Note that this
will send your password across the Internet in clear text (unless the
server is using CRAM-MD5 for challenge/response authentication, but still
not a great idea). You could potentially change your SMTP password
temporarily when you disable EMAIL_USE_TLS and change it back afterwards to
be safe. If there is no encryption set in your email client, I wouldn't
worry about changing the password since your email client is probably
sending it out every 10 minutes anyway.

When you say 'python shell' do you mean an actual Python shell (ie. just
typing python and manually importing the send_mail function) or are you
starting a Python shell via 'python manage.py shell'? If you are using a
vanilla python shell (no manage.py), the send_mail function may be relying
on defaults since it won't take into account your settings.py file (which
may try to relay through a local SMTP server on localhost, I haven't
looked). If you are starting it through the manage.py shell, then I'm not
sure where to go from there other than twiddling the settings I mentioned.

Does the traceback come back immediately when you execute the view, or does
it seem like it needs a fair amount of time to 'time out' (several seconds
or probably more)? If it is the former, we're probably still looking at a
DNS problem, if it is the latter, my guess is the EMAIL_USE_TLS variable
being set to True.

Since you have shell access, you could also potentially test the connection
directly using the command:

$ telnet mail.pep.co.ir 25
Trying 79.175.161.174... Connected to mail.pep.co.ir. Escape character is
'^]'. 220 CMS5 HighMail ESMTP Service, Version: 2008.8.0.0.4 ready at Thu,
8 Jan 2015 13:55:59 +0330 ehlo pep.co.ir 250-CMS5 says hello 250-DSN
250-AUTH LOGIN CRAM-MD5 250-AUTH=LOGIN 250 ok

I typed 'ehlo pep.co.ir' after the initial connection to show the various
authentication schemes and operations offered by the SMTP server. Just type
quit to exit. If you do test it, as long as you get the "220 CMS5 HighMail
ESMTP..." line, you should be in good shape. Normally I would expect to see
"250-STARTTLS" as one of the options (indicating TLS is supported).

Another option would be to try using the IP rather than the name for
EMAIL_HOST. In this case it would be '79.175.161.174' from your nslookup
command earlier. This 'should' bypass the DNS query to resolve the
EMAIL_HOST to an IP address (since it is already an IP). If that works,
then you definitely have some kind of DNS issue.

-James



On Thu, Jan 8, 2015 at 1:14 AM, Hossein Rashnoo  wrote:

> Thank you for your reply, it seems that every thing is ok:
> $ nslookup mail.pep.co.ir 
>
> Server: 10.252.84.50
> Address:10.252.84.50#53
>
> Non-authoritative answer:
> Name:   mail.pep.co.ir
> Address: 79.175.161.174
>
>
> and:
>
> $ python manage.py shell
>
> >>> import socket
> >>> socket.gethostbyname("mail.pep.co.ir")
> '79.175.161.174'
>
> I attach the whole traceback with this reply.thank you.
>
>
> On Thursday, January 8, 2015 12:08:26 PM UTC+3:30, James Schneider wrote:
>
>> Can you send the whole traceback?
>>
>> Name resolution errors indicate an issue with DNS reachability, or a
>> domain name incorrectly entered somewhere. I'm assuming that you are
>> running the shell on the same server that is running your Django instance?
>> You should be able to do the following on the server where Django is
>> running:
>>
>> $ python manage.py shell
>> >>> import socket
>> >>> # checks if name resolution is working at all
>> >>> socket.gethostbyname('www.google.com')
>> '74.125.20.105'
>> >>> # note you may get a different IP address
>> >>>
>> >>> # check if your email host value is resolvable
>> >>> socket.gethostbyname("mail.xx.ir")
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> gaierror: [Errno -5] No address associated with hostname
>> >>>
>>
>> Obviously I receiv

Re: How to run background application via Django

2015-01-08 Thread Mario Gudelj
Look into celery. It's the best and easiest way to run bg jobs imo
On 08/01/2015 9:10 pm, "Sugita Shinsuke"  wrote:

> Hi there.
>
> I'd like to run background application.
>
> I coded this code.
>
> I wrote the urls.py and I added in the view.
>
> def run_junix(request):
> cmd = "cd app_path;nohup python background_app.py &"
> import subprocess
> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT)
>
> return HttpResponse("bg test")
>
> Is it good way? or using supervisor or, if you know the better way, would
> you tell me?
>
> Anyone who know this matter, please help.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnHWho4t5KAV9cf0fbKvckGpTCBFycKnxWdR7SAK2W9OA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi there.

I'd like to run background application.

I coded this code.

I wrote the urls.py and I added in the view.

def run_junix(request):
cmd = "cd app_path;nohup python background_app.py &"
import subprocess
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)

return HttpResponse("bg test")

Is it good way? or using supervisor or, if you know the better way, would 
you tell me?

Anyone who know this matter, please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django form field validation and error display

2015-01-08 Thread 赵飞
I want to make a signup page, when user click signup, it will check if the 
two password are the same, when not, give a error message after "confirm 
password". 

But when I call "return render(request, reverse("accounts:signup"), 
{'form': signup_form}) " in my views.py, it shows me an error, the 
traceback is:

 Environment:

Request Method: POST
   Request URL: http://127.0.0.1:8000/accounts/signup_post/
   
   Django Version: 1.7
   Python Version: 2.7.5
   Installed Applications:
   ('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts')
   Installed Middleware:
   ('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
   
   Template Loader Error:
   Django tried loading these templates, in this order:
   Using loader django.template.loaders.filesystem.Loader:
   Using loader django.template.loaders.app_directories.Loader:
   
   Traceback:
   File 
"/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in get_response
 111. response = wrapped_callback(request, 
*callback_args, **callback_kwargs)
   File "/Users/feizhao/dropbox/nahan/accounts/views.py" in signup_post
 64. return render(request, reverse("accounts:signup"), {'form': 
signup_form})
   File 
"/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/shortcuts.py"
 
in render
 48. return HttpResponse(loader.render_to_string(*args, **kwargs),
   File 
"/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
 
in render_to_string
 170. t = get_template(template_name, dirs)
   File 
"/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
 
in get_template
 144. template, origin = find_template(template_name, dirs)
   File 
"/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/template/loader.py"
 
in find_template
 136. raise TemplateDoesNotExist(name)
   
   Exception Type: TemplateDoesNotExist at /accounts/signup_post/
   Exception Value: /accounts/signup/

my account app looks like:

   $ tree -L 3 accounts
   accounts
   ├── __init__.py
   ├── admin.py
   ├── forms.py
   ├── locale
   │   └── zh_CN
   ├── migrations
   │   ├── 0001_initial.py
   │   ├── __init__.py
   ├── models.py
   ├── static
   │   └── accounts
   │   └── login.css
   ├── templates
   │   └── accounts
   │   ├── base.html
   │   ├── login.html
   │   └── signup.html
   ├── tests.py
   ├── urls.py
   ├── views.py

 urls.py:

urlpatterns = patterns(
   '',
   url(r'^accounts/', include('accounts.urls', namespace="accounts")),
   url(r'^admin/', include(admin.site.urls)),
   )

accounts/urls.py:

urlpatterns = patterns(
   '',
   url(r'^login/$', views.login, name='login'),
   url(r'^signup/$', views.signup, name='signup'),
   url(r'^login_post/$', views.login_post, name='login_post'),
   url(r'^signup_post/$', views.signup_post, name='signup_post'),
   )

signup_post function in views.py: 

def signup_post(request):
   if request.method == 'POST':
   signup_form = forms.SignupForm(request.POST)
   
   if signup_form.is_valid():
   signup_info = signup_form.cleaned_data
   username = signup_info['username']
   email = signup_info['email']
   password = signup_info['password_1']
   user = User.objects.create_user(
   username=username,
   email=email,
   password=password)
   user.save()
   
   else:
   signup_form = forms.SignupForm()
   
   return render(request, reverse("accounts:signup"), {'form': 
signup_form})

I have read [Django TemplateDoesNotExist][1] and other similar questions, 
but no help!

  [1]: 
https://stackoverflow.com/questions/4765003/django-templatedoesnotexist

在 2015年1月7日星期三UTC+8下午10时03分09秒,赵飞写道:
>
> I want to make a signup page just like:
>
>
> 
> When user click signup, I want to check the if the two password are the 
> same, when not, give a error message after "confirm password".  Here is my 
> code:
>
> *forms.py*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *class SignupForm(forms.Form):username = forms.CahrField(
> label=_("username"),max_leng

Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread Hossein Rashnoo
Thank you for your reply, it seems that every thing is ok:
$ nslookup mail.pep.co.ir 

Server: 10.252.84.50
Address:10.252.84.50#53

Non-authoritative answer:
Name:   mail.pep.co.ir
Address: 79.175.161.174


and:

$ python manage.py shell

>>> import socket
>>> socket.gethostbyname("mail.pep.co.ir")
'79.175.161.174'

I attach the whole traceback with this reply.thank you.


On Thursday, January 8, 2015 12:08:26 PM UTC+3:30, James Schneider wrote:
>
> Can you send the whole traceback?
>
> Name resolution errors indicate an issue with DNS reachability, or a 
> domain name incorrectly entered somewhere. I'm assuming that you are 
> running the shell on the same server that is running your Django instance? 
> You should be able to do the following on the server where Django is 
> running:
>
> $ python manage.py shell
> >>> import socket
> >>> # checks if name resolution is working at all
> >>> socket.gethostbyname('www.google.com')
> '74.125.20.105'
> >>> # note you may get a different IP address
> >>>
> >>> # check if your email host value is resolvable
> >>> socket.gethostbyname("mail.xx.ir")
> Traceback (most recent call last):
>   File "", line 1, in 
> gaierror: [Errno -5] No address associated with hostname
> >>> 
>
> Obviously I received an error here since I used the masked value you 
> provided. You should get an IPv4/IPv6 address back, or an error similar to 
> the one you posted.
>
> You can also do a quick check if you have shell or command prompt access 
> available on your server outside of Python:
>
> $ nslookup www.google.com
> Server: 127.0.1.1
> Address: 127.0.1.1#53
>
> Non-authoritative answer:
> Name: www.google.com
> Address: 74.125.239.112
> Name: www.google.com
> Address: 74.125.239.114
> Name: www.google.com
> Address: 74.125.239.113
> Name: www.google.com
> Address: 74.125.239.116
> Name: www.google.com
> Address: 74.125.239.115
>
> $ nslookup mail.xx.ir
> Server: 127.0.1.1
> Address: 127.0.1.1#53
>
> ** server can't find mail.xx.ir: NXDOMAIN
>
> An NXDOMAIN response means that the domain is either typed incorrectly, or 
> just doesn't exist out on the wild Internet (or wherever your DNS server 
> recursively looks for you)
>
> That command should work on Windows and most Linux distributions (some 
> Linux systems include the 'host' command as an alternative if BIND tools 
> are installed). The output may be formatted differently but should provide 
> similar information.
>
> The full traceback for the error will likely be most helpful, though.
>
>
> -James
>
> On Thu, Jan 8, 2015 at 12:08 AM, Hossein Rashnoo  > wrote:
>
>> Hi
>> I use this settings to send email:
>>
>> settings.py
>> EMAIL_HOST = "mail.xx.ir"
>> EMAIL_PORT = "25"
>> EMAIL_HOST_USER = "xx...@xxx.ir "
>> EMAIL_HOST_PASSWORD = ""
>> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
>> DEFAULT_FROM_EMAIL  = 'xx...@xxx.ir '
>>
>> and in python shell:
>> from django.core.mail import send_mail
>> send_mail('test', 'hello', 'xx...@xxx.ir ', ['
>> mye...@gmail.com '])
>>
>> And its successfully sent But when i use that two line code in view, i 
>> got this error:
>> gaierror at /userforget/ 
>>
>> [Errno -3] Temporary failure in name resolution
>>
>>
>> Please help me.
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6aaaeaac-dc68-477a-b2d7-7b2821097c36%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c3f6d078-c5d7-48f2-812a-9c078ac50a34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gaierror at /userforget/

[Errno -3] Temporary failure in name resolution

Request Method: POST
Request URL:http://10.252.84.159/userforget/
Django Version: 1.6.8
Exception Type: gaierror
Exception Value:

[Errno -3] Temporary failure in name resolution

Exception Location: /usr/lib64/python2.6/socket.py in create_connection, 
line 553
Python Executa

Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Sugita Shinsuke
Hello Vijay Khemlani 

Thank you for replying.
But, of cause I appended the tag in my form like below


{% csrf_token %}

but I wonder about that using the iframe is bad.

The form is child of iframe.

I also checked Chrome's developer tool.
The csrf token was saved in the cookie.

2015年1月6日火曜日 23時00分10秒 UTC+9 Vijay Khemlani:
>
> ¿Did you include de {% csrf_token %} tag in the form? ¿Is it generating 
> the corresponding hidden input tag in the html?
>
> On Tue, Jan 6, 2015 at 6:09 AM, Sugita Shinsuke  > wrote:
>
>> Hello.
>>
>> When I use Django via my smart phone Android and iOS.
>> The error sometimes occurred.
>>
>> Forbidden (403)
>> CSRF verification failed. Request aborted.
>> Help
>> Reason given for failure:
>> CSRF token missing or incorrect.
>>
>> In general, this can occur when there is a genuine Cross Site Request 
>> Forgery, or when Django's CSRF mechanism has not been used correctly. For 
>> POST forms, you need to ensure:
>> Your browser is accepting cookies.
>> The view function uses RequestContext for the template, instead of 
>> Context.
>> In the template, there is a {% csrf_token %} template tag inside each 
>> POST form that targets an internal URL.
>> If you are not using CsrfViewMiddleware, then you must use csrf_protect 
>> on any views that use the csrf_token template tag, as well as those that 
>> accept the POST data.
>> You're seeing the help section of this page because you have DEBUG = True 
>> in your Django settings file. Change that to False, and only the initial 
>> error message will be displayed.
>> You can customize this page using the CSRF_FAILURE_VIEW setting.
>>
>> I append django.middleware.csrf.CsrfViewMiddleware', of 
>> MIDDLEWARE_CLASSES in settings.py
>>
>> I use
>> Python 2.7.5
>> Django 1.6.4
>>
>> Anyone who know this matter, please help.
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e0db1d43-8897-40fc-be1d-65c76d9da503%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/638deb22-6cad-453c-ad07-13704f310ad0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread James Schneider
Can you send the whole traceback?

Name resolution errors indicate an issue with DNS reachability, or a domain
name incorrectly entered somewhere. I'm assuming that you are running the
shell on the same server that is running your Django instance? You should
be able to do the following on the server where Django is running:

$ python manage.py shell
>>> import socket
>>> # checks if name resolution is working at all
>>> socket.gethostbyname('www.google.com')
'74.125.20.105'
>>> # note you may get a different IP address
>>>
>>> # check if your email host value is resolvable
>>> socket.gethostbyname("mail.xx.ir")
Traceback (most recent call last):
  File "", line 1, in 
gaierror: [Errno -5] No address associated with hostname
>>>

Obviously I received an error here since I used the masked value you
provided. You should get an IPv4/IPv6 address back, or an error similar to
the one you posted.

You can also do a quick check if you have shell or command prompt access
available on your server outside of Python:

$ nslookup www.google.com
Server: 127.0.1.1
Address: 127.0.1.1#53

Non-authoritative answer:
Name: www.google.com
Address: 74.125.239.112
Name: www.google.com
Address: 74.125.239.114
Name: www.google.com
Address: 74.125.239.113
Name: www.google.com
Address: 74.125.239.116
Name: www.google.com
Address: 74.125.239.115

$ nslookup mail.xx.ir
Server: 127.0.1.1
Address: 127.0.1.1#53

** server can't find mail.xx.ir: NXDOMAIN

An NXDOMAIN response means that the domain is either typed incorrectly, or
just doesn't exist out on the wild Internet (or wherever your DNS server
recursively looks for you)

That command should work on Windows and most Linux distributions (some
Linux systems include the 'host' command as an alternative if BIND tools
are installed). The output may be formatted differently but should provide
similar information.

The full traceback for the error will likely be most helpful, though.


-James

On Thu, Jan 8, 2015 at 12:08 AM, Hossein Rashnoo  wrote:

> Hi
> I use this settings to send email:
>
> settings.py
> EMAIL_HOST = "mail.xx.ir"
> EMAIL_PORT = "25"
> EMAIL_HOST_USER = "xx...@xxx.ir"
> EMAIL_HOST_PASSWORD = ""
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
> DEFAULT_FROM_EMAIL  = 'xx...@xxx.ir'
>
> and in python shell:
> from django.core.mail import send_mail
> send_mail('test', 'hello', 'xx...@xxx.ir', ['myem...@gmail.com'])
>
> And its successfully sent But when i use that two line code in view, i got
> this error:
> gaierror at /userforget/
>
> [Errno -3] Temporary failure in name resolution
>
>
> Please help me.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6aaaeaac-dc68-477a-b2d7-7b2821097c36%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUUKDBbGUOCN2D1QeSKsd6D6jT6gT%2BWnuwn6%3DgEqFvUxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


I can send mail with shell but can't sent mail via view

2015-01-08 Thread Hossein Rashnoo
Hi
I use this settings to send email:

settings.py
EMAIL_HOST = "mail.xx.ir"
EMAIL_PORT = "25"
EMAIL_HOST_USER = "xx...@xxx.ir"
EMAIL_HOST_PASSWORD = ""
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_FROM_EMAIL  = 'xx...@xxx.ir'

and in python shell:
from django.core.mail import send_mail
send_mail('test', 'hello', 'xx...@xxx.ir', ['myem...@gmail.com'])

And its successfully sent But when i use that two line code in view, i got 
this error:
gaierror at /userforget/ 

[Errno -3] Temporary failure in name resolution


Please help me.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6aaaeaac-dc68-477a-b2d7-7b2821097c36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.