Re: I am unable to get the choice field to validate on creating users. it doesn't make sense at all.

2014-03-20 Thread sashank reddy
Hi Tom,

I have not understood what you have said. Shouldn't choice_desig be called 
every time I instantiate it in the view with the form = New_user_form(). I 
thought I was creating an object of New_user_form every time I do that.

Regards,
Preetam

On Wednesday, 19 March 2014 22:11:52 UTC+5:30, sashank reddy wrote:
>
>
> Hi Tom,
>
> What do you mean callable?
> I tried changing
> desig_group = forms.ChoiceField(choices=choice_desig()) 
> to
> desig_group = forms.ChoiceField(choices=choice_desig)
>
> It gave error 'function' object is not iterable. 
> But I want to know if the following would work.
>
> desig = forms.ModelChoiceField(queryset=Group.objects.all())
>
> But how do I change my view and template for it.
> Can you please correct my view and template.
>
> Regards,
> Preetam
>
> On Wednesday, 19 March 2014 21:43:39 UTC+5:30, Tom Evans wrote:
>>
>> On Wed, Mar 19, 2014 at 3:40 PM, sashank reddy 
>>  wrote: 
>> > Hi, 
>> > 
>> > I have been trying to extend the UserCreationForm and have a form which 
>> > performs user registration and adds email and the names. 
>> > In addition I am using a choice field that allows a list down of 
>> existing 
>> > groups so that you can assign the user to an group immediately  upon 
>> > creation. 
>> > 
>> > The problem is that, if I create a new group, and try to add users to 
>> it, 
>> > then the form validation fails. 
>> > I have restart the django server or wait for it to reset internally and 
>> show 
>> > "Validating models ..". Then it starts to work. 
>> > 
>> > The following is the code snippet: 
>> > 
>> =
>>  
>>
>> > def choice_desig(): 
>> > choice_desig = [] 
>> > g = Group.objects.all() 
>> > for k in g: 
>> > choice_desig.append((k.name, k.name)) 
>> > return choice_desig 
>> > 
>> > class New_user_form(UserCreationForm): 
>> > email = forms.EmailField(required=True) 
>> > first_name = forms.CharField(required=True) 
>> > last_name = forms.CharField(required=True) 
>> > desig_group = forms.ChoiceField(choices=choice_desig()) 
>>
>> If you use choice_desig() function like that, it will get called once, 
>> when the server initially parses that file. It will never be run again 
>> until the server re-parses that file. 
>>
>> You could pass a callable to choices - "choices=choice_desig". 
>>
>> However, the right solution for when you want a form field to choose a 
>> model instance is to use a form.ModelChoiceField. 
>>
>> Cheers 
>>
>> Tom 
>>
>

-- 
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/3392e13f-6933-4825-b3c0-e672c39e2a13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simple User login not working.

2014-03-20 Thread Venkatraman S
I cannot see the screenshot, but two things:
1. Why GET? :-/
2. Did you check if the users are 'active'? i.e, active flag set?

-Venkat


On Thu, Mar 20, 2014 at 1:51 AM, Don Fox  wrote:

> My project has two superusers who have access to the Django Administration
> and who manually add about 15 Users who should then be able to login and
> use the site to do data entry.
>
> I'm using the standard code in my views
>
>
> *def auth_view(request):*
> *username = request.POST.get('username',' ')*
> *password = request.POST.get('password',' ')*
> *user = auth.authenticate(username=username, password=password)*
>
> *if user is not None:*
> *auth.login(request, user)*
> *return HttpResponseRedirect('/accounts/loggedin')*
> *else:*
> *return HttpResponseRediredt('/accounts/invalid') *
>
>
> This should check against the users listed in the admin page?
>
>
> [image: ]
>
>
> However ther is no acknowledgement from the loggedin.hml template.
>
>
> Does anything come to mind that I have newgelected to do to get the login
> to work.
>
>  --
> 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/23a01c55-436b-4514-8be4-ed6a6915f879%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/CAN7tdFRWxq05gK%3DO%2BaEoS1GhFC-VMcd2xCQST_m_tf1kFUCnGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: submit buttons in django

2014-03-20 Thread Venkatraman S
Add the required view to redirect once this button is clicked.

-Venkat


On Thu, Mar 20, 2014 at 9:18 AM, Harjot Mann wrote:

> I have a form in my app and after entering data into that form I
> submit that form but I want an another submit button like "Submit and
> Add Event", so that after clicking on it it can redirect to an another
> form. Please help me that how can I do this?
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
>
> --
> 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/CAB0GQhBN_k%3Db8NHf8L4oZ1EWr-uya%3DhbotCZPGNam6ezy77vAg%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/CAN7tdFSmLnn0EXYXgj0R_BodS4dGB0i38xEeG9JeG0Sg5Z1Dtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-20 Thread Venkatraman S
On Sat, Mar 15, 2014 at 7:11 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

>
> On Sat, Mar 15, 2014 at 7:19 AM, Jonathan Baker <
> jonathandavidba...@gmail.com> wrote:
>
>> Does that mean that the default="" functionality is implemented by the
>> ORM, instead of in the database layer?
>>
>> This is correct - Django's "default" argument is an API level default,
> not a database level default.
>
>
@Russ, any specific reasons for this choice?

Regards,
Venkat

-- 
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/CAN7tdFR83z8_zjWdVszavKhUsz%3D3dCiT6kHZjQKcYVKgP6fMDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I am unable to get the choice field to validate on creating users. it doesn't make sense at all.

2014-03-20 Thread Tom Evans
On Thu, Mar 20, 2014 at 10:12 AM, sashank reddy
 wrote:
> Hi Tom,
>
> I have not understood what you have said. Shouldn't choice_desig be called
> every time I instantiate it in the view with the form = New_user_form(). I
> thought I was creating an object of New_user_form every time I do that.

This is pretty basic python, the function is run when python
interprets the class.

Eg,

class Foo(object):
  some_var = 'this is a string'.split()

The string is split only once, when the class Foo is parsed by python,
not whenever an instance of Foo is instantiated. Things that happen
when an instance is instantiated are contained in the __init__ method.

Although the some_var looks like it is just declaring a class
attribute, it is actually just running code in the scope of the class,
and as such you can write almost any code there (contrast with
definition of class variables in java). Eg this is perfectly valid:

class Foo(object):
  some_var = 'this is a string'.split()
  some_var = some_var[1:]
  some_var.sort()


Cheers

Tom

-- 
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/CAFHbX1JiOB60zL9kkgb6pbjAHpkRKs%2B5onFzS27ptgP_m9mLXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: submit buttons in django

2014-03-20 Thread Harjot Mann
On Thu, Mar 20, 2014 at 4:12 PM, Venkatraman S  wrote:
> Add the required view to redirect once this button is clicked.


Will the data be saved into database with this method?

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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/CAB0GQhBm3v3DE31d8A_T0BDJC-dPUZHx20vnew_WszXMpopbFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[GSOC] Django-based project for the neuroinformatics community: neurostars.org

2014-03-20 Thread Roman Valls Guimerà


Hello Django users,

>From django-developers mailing list I have been told that list is more 
>appropiate for 

this type of announcement... so here I go, sorry if it bothers you.


At http://incf.org, we launched a Stackoverflow-like website to engage the 

neuroscientific community:


http://neurostars.org


You can have a look at some ideas we came up with to improve the site if 
someone is interested:
http://x90.es/neurostarsgsoc 


There is very little time left to setup a proposal, but luckily we have a 
template you can use:


http://www.google-melange.com/gsoc/org2/google/gsoc2014/incf


All you need to do is signup on Google Melange, fill your profile and submit 

your proposal to the "International Neuroinformatics Coordinating Facility":


http://www.google-melange.com/gsoc/homepage/google/gsoc2014


Time is really running out, tomorrow 21st at 13h google with close student 
applications.


Feel free to contact me if you need more details!

Best regards,
Roman

-- 
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/3ff58128-b6a5-46fc-9aee-ea1bb795b2c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
I am new to Django (but not new to python) and I am looking forward to 
create a customized  page using django.  I have read about django's inbuilt 
authentication system but I want build it from scratch So here are the few 
ideas I am stumbling upon :


   1. Creating a *users* class in the models.py with username and password 
   as the fields (both are CharField)
   
   2. Creating  two views one named *LoginView*, which will depict the 
   initial login page (such as a *form* imported from a *module named 
forms.py*) and another view named *LoggedInView* which will show only 
   the username of the logged user
   
   3. Mapping them into corresponding URLs

I tried creating it with above mentioned thoughts but I got stuck with an 
error as follows:

Forbidden (403)

CSRF verification failed. Request aborted.
Help

Reason given for failure:

CSRF cookie not set.


I couldn't figure out why possibly I am getting this error for 
incorporating such a simple(and basic) functionality.

*I want to understand the best way/approach to go about this (for 
implementing this functionality). I am not worrying about the error for the 
time being since I didn't spend much time thinking about it (So I am not 
posting any code). I want to get my approach right first. I want to be 
flawless while implementing such basic and elementary stuffs.  *

-- 
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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread Robin Lery
do you have {% csrf_token % } in your forms?


On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta wrote:

> I am new to Django (but not new to python) and I am looking forward to
> create a customized  page using django.  I have read about django's inbuilt
> authentication system but I want build it from scratch So here are the few
> ideas I am stumbling upon :
>
>
>1. Creating a *users* class in the models.py with username and
>password as the fields (both are CharField)
>
>2. Creating  two views one named *LoginView*, which will depict the
>initial login page (such as a *form* imported from a *module named
> forms.py*) and another view named *LoggedInView* which will show only
>the username of the logged user
>
>3. Mapping them into corresponding URLs
>
> I tried creating it with above mentioned thoughts but I got stuck with an
> error as follows:
>
> Forbidden (403)
>
> CSRF verification failed. Request aborted.
> Help
>
> Reason given for failure:
>
> CSRF cookie not set.
>
>
> I couldn't figure out why possibly I am getting this error for
> incorporating such a simple(and basic) functionality.
>
> *I want to understand the best way/approach to go about this (for
> implementing this functionality). I am not worrying about the error for the
> time being since I didn't spend much time thinking about it (So I am not
> posting any code). I want to get my approach right first. I want to be
> flawless while implementing such basic and elementary stuffs.  *
>
> --
> 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Yes I do Where am I going wrong then?
On 20 Mar 2014 20:06, "Robin Lery"  wrote:

> do you have {% csrf_token % } in your forms?
>
>
> On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta 
> wrote:
>
>> I am new to Django (but not new to python) and I am looking forward to
>> create a customized  page using django.  I have read about django's inbuilt
>> authentication system but I want build it from scratch So here are the few
>> ideas I am stumbling upon :
>>
>>
>>1. Creating a *users* class in the models.py with username and
>>password as the fields (both are CharField)
>>
>>2. Creating  two views one named *LoginView*, which will depict the
>>initial login page (such as a *form* imported from a *module named
>> forms.py*) and another view named *LoggedInView* which will show
>>only the username of the logged user
>>
>>3. Mapping them into corresponding URLs
>>
>> I tried creating it with above mentioned thoughts but I got stuck with an
>> error as follows:
>>
>> Forbidden (403)
>>
>> CSRF verification failed. Request aborted.
>> Help
>>
>> Reason given for failure:
>>
>> CSRF cookie not set.
>>
>>
>> I couldn't figure out why possibly I am getting this error for
>> incorporating such a simple(and basic) functionality.
>>
>> *I want to understand the best way/approach to go about this (for
>> implementing this functionality). I am not worrying about the error for the
>> time being since I didn't spend much time thinking about it (So I am not
>> posting any code). I want to get my approach right first. I want to be
>> flawless while implementing such basic and elementary stuffs.  *
>>
>> --
>> 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread François Schiettecatte
You may be missing some middleware, eg:

'django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 

'django.contrib.sessions',

Maybe your browser is rejecting cookies.

François

On Mar 20, 2014, at 10:43 AM, Aryak Sengupta  wrote:

> Yes I do Where am I going wrong then?
> 
> On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> do you have {% csrf_token % } in your forms?
> 
> 
> On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta  
> wrote:
> I am new to Django (but not new to python) and I am looking forward to create 
> a customized  page using django.  I have read about django's inbuilt 
> authentication system but I want build it from scratch So here are the few 
> ideas I am stumbling upon :
> 
>   • Creating a users class in the models.py with username and password as 
> the fields (both are CharField)
> 
>   • Creating  two views one named LoginView, which will depict the 
> initial login page (such as a form imported from a module named  forms.py) 
> and another view named LoggedInView which will show only the username of the 
> logged user
> 
>   • Mapping them into corresponding URLs
> I tried creating it with above mentioned thoughts but I got stuck with an 
> error as follows:
> 
> Forbidden (403)
> CSRF verification failed. Request aborted.
> Help
> 
> Reason given for failure:
> CSRF cookie not set.
> 
> I couldn't figure out why possibly I am getting this error for incorporating 
> such a simple(and basic) functionality.
> 
> I want to understand the best way/approach to go about this (for implementing 
> this functionality). I am not worrying about the error for the time being 
> since I didn't spend much time thinking about it (So I am not posting any 
> code). I want to get my approach right first. I want to be flawless while 
> implementing such basic and elementary stuffs.  
> 
> -- 
> 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Can you please elaborate
On 20 Mar 2014 20:17, "François Schiettecatte" 
wrote:

> You may be missing some middleware, eg:
>
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
>
> 'django.contrib.sessions',
>
> Maybe your browser is rejecting cookies.
>
> François
>
> On Mar 20, 2014, at 10:43 AM, Aryak Sengupta 
> wrote:
>
> > Yes I do Where am I going wrong then?
> >
> > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > do you have {% csrf_token % } in your forms?
> >
> >
> > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta 
> wrote:
> > I am new to Django (but not new to python) and I am looking forward to
> create a customized  page using django.  I have read about django's inbuilt
> authentication system but I want build it from scratch So here are the few
> ideas I am stumbling upon :
> >
> >   * Creating a users class in the models.py with username and
> password as the fields (both are CharField)
> >
> >   * Creating  two views one named LoginView, which will depict the
> initial login page (such as a form imported from a module named  forms.py)
> and another view named LoggedInView which will show only the username of
> the logged user
> >
> >   * Mapping them into corresponding URLs
> > I tried creating it with above mentioned thoughts but I got stuck with
> an error as follows:
> >
> > Forbidden (403)
> > CSRF verification failed. Request aborted.
> > Help
> >
> > Reason given for failure:
> > CSRF cookie not set.
> >
> > I couldn't figure out why possibly I am getting this error for
> incorporating such a simple(and basic) functionality.
> >
> > I want to understand the best way/approach to go about this (for
> implementing this functionality). I am not worrying about the error for the
> time being since I didn't spend much time thinking about it (So I am not
> posting any code). I want to get my approach right first. I want to be
> flawless while implementing such basic and elementary stuffs.
> >
> > --
> > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%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/CALTbq1xzxJ8LmH6gkLSMcFZ5Ec0X-XW7q1N0v0YpnX_qoJVWtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread François Schiettecatte
See https://docs.djangoproject.com/en/1.6/topics/http/sessions/

On Mar 20, 2014, at 10:50 AM, Aryak Sengupta  wrote:

> Can you please elaborate
> 
> On 20 Mar 2014 20:17, "François Schiettecatte"  
> wrote:
> You may be missing some middleware, eg:
> 
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 
> 'django.contrib.sessions',
> 
> Maybe your browser is rejecting cookies.
> 
> François
> 
> On Mar 20, 2014, at 10:43 AM, Aryak Sengupta  wrote:
> 
> > Yes I do Where am I going wrong then?
> >
> > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > do you have {% csrf_token % } in your forms?
> >
> >
> > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta  
> > wrote:
> > I am new to Django (but not new to python) and I am looking forward to 
> > create a customized  page using django.  I have read about django's inbuilt 
> > authentication system but I want build it from scratch So here are the few 
> > ideas I am stumbling upon :
> >
> >   • Creating a users class in the models.py with username and password 
> > as the fields (both are CharField)
> >
> >   • Creating  two views one named LoginView, which will depict the 
> > initial login page (such as a form imported from a module named  forms.py) 
> > and another view named LoggedInView which will show only the username of 
> > the logged user
> >
> >   • Mapping them into corresponding URLs
> > I tried creating it with above mentioned thoughts but I got stuck with an 
> > error as follows:
> >
> > Forbidden (403)
> > CSRF verification failed. Request aborted.
> > Help
> >
> > Reason given for failure:
> > CSRF cookie not set.
> >
> > I couldn't figure out why possibly I am getting this error for 
> > incorporating such a simple(and basic) functionality.
> >
> > I want to understand the best way/approach to go about this (for 
> > implementing this functionality). I am not worrying about the error for the 
> > time being since I didn't spend much time thinking about it (So I am not 
> > posting any code). I want to get my approach right first. I want to be 
> > flawless while implementing such basic and elementary stuffs.
> >
> > --
> > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%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/CALTbq1xzxJ8LmH6gkLSMcFZ5Ec0X-XW7q1N0v0YpnX_qoJVWtg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Alright... Thanks  a lot. But do I really require using sessions for
implementing this simple functionality ... Or is it just a bad design that
I had been trying?
On 20 Mar 2014 20:28, "François Schiettecatte" 
wrote:

> See https://docs.djangoproject.com/en/1.6/topics/http/sessions/
>
> On Mar 20, 2014, at 10:50 AM, Aryak Sengupta 
> wrote:
>
> > Can you please elaborate
> >
> > On 20 Mar 2014 20:17, "François Schiettecatte" 
> wrote:
> > You may be missing some middleware, eg:
> >
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.middleware.csrf.CsrfViewMiddleware',
> >
> > 'django.contrib.sessions',
> >
> > Maybe your browser is rejecting cookies.
> >
> > François
> >
> > On Mar 20, 2014, at 10:43 AM, Aryak Sengupta 
> wrote:
> >
> > > Yes I do Where am I going wrong then?
> > >
> > > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > > do you have {% csrf_token % } in your forms?
> > >
> > >
> > > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta <
> aryaksengu...@gmail.com> wrote:
> > > I am new to Django (but not new to python) and I am looking forward to
> create a customized  page using django.  I have read about django's inbuilt
> authentication system but I want build it from scratch So here are the few
> ideas I am stumbling upon :
> > >
> > >   * Creating a users class in the models.py with username and
> password as the fields (both are CharField)
> > >
> > >   * Creating  two views one named LoginView, which will depict the
> initial login page (such as a form imported from a module named  forms.py)
> and another view named LoggedInView which will show only the username of
> the logged user
> > >
> > >   * Mapping them into corresponding URLs
> > > I tried creating it with above mentioned thoughts but I got stuck with
> an error as follows:
> > >
> > > Forbidden (403)
> > > CSRF verification failed. Request aborted.
> > > Help
> > >
> > > Reason given for failure:
> > > CSRF cookie not set.
> > >
> > > I couldn't figure out why possibly I am getting this error for
> incorporating such a simple(and basic) functionality.
> > >
> > > I want to understand the best way/approach to go about this (for
> implementing this functionality). I am not worrying about the error for the
> time being since I didn't spend much time thinking about it (So I am not
> posting any code). I want to get my approach right first. I want to be
> flawless while implementing such basic and elementary stuffs.
> > >
> > > --
> > > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%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/CALTbq1xzxJ8LmH6gkLSMcFZ5Ec0X-XW7q1N0v0YpnX_qoJVWtg%40mail.gmail.com
> .
> > For more options, visit http

Re: Custom Login page in Django

2014-03-20 Thread François Schiettecatte
You need to have sessions if you want login so you can tie a browser to a user, 
and the CSRF is tied to the session cookie.

F.

On Mar 20, 2014, at 11:28 AM, Aryak Sengupta  wrote:

> Alright... Thanks  a lot. But do I really require using sessions for 
> implementing this simple functionality ... Or is it just a bad design that I 
> had been trying?
> 
> On 20 Mar 2014 20:28, "François Schiettecatte"  
> wrote:
> See https://docs.djangoproject.com/en/1.6/topics/http/sessions/
> 
> On Mar 20, 2014, at 10:50 AM, Aryak Sengupta  wrote:
> 
> > Can you please elaborate
> >
> > On 20 Mar 2014 20:17, "François Schiettecatte"  
> > wrote:
> > You may be missing some middleware, eg:
> >
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.middleware.csrf.CsrfViewMiddleware',
> >
> > 'django.contrib.sessions',
> >
> > Maybe your browser is rejecting cookies.
> >
> > François
> >
> > On Mar 20, 2014, at 10:43 AM, Aryak Sengupta  
> > wrote:
> >
> > > Yes I do Where am I going wrong then?
> > >
> > > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > > do you have {% csrf_token % } in your forms?
> > >
> > >
> > > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta  
> > > wrote:
> > > I am new to Django (but not new to python) and I am looking forward to 
> > > create a customized  page using django.  I have read about django's 
> > > inbuilt authentication system but I want build it from scratch So here 
> > > are the few ideas I am stumbling upon :
> > >
> > >   • Creating a users class in the models.py with username and 
> > > password as the fields (both are CharField)
> > >
> > >   • Creating  two views one named LoginView, which will depict the 
> > > initial login page (such as a form imported from a module named  
> > > forms.py) and another view named LoggedInView which will show only the 
> > > username of the logged user
> > >
> > >   • Mapping them into corresponding URLs
> > > I tried creating it with above mentioned thoughts but I got stuck with an 
> > > error as follows:
> > >
> > > Forbidden (403)
> > > CSRF verification failed. Request aborted.
> > > Help
> > >
> > > Reason given for failure:
> > > CSRF cookie not set.
> > >
> > > I couldn't figure out why possibly I am getting this error for 
> > > incorporating such a simple(and basic) functionality.
> > >
> > > I want to understand the best way/approach to go about this (for 
> > > implementing this functionality). I am not worrying about the error for 
> > > the time being since I didn't spend much time thinking about it (So I am 
> > > not posting any code). I want to get my approach right first. I want to 
> > > be flawless while implementing such basic and elementary stuffs.
> > >
> > > --
> > > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%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%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%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-u

Re: [GSOC] Django-based project for the neuroinformatics community: neurostars.org

2014-03-20 Thread Venkatraman S
On Thu, Mar 20, 2014 at 3:46 PM, Roman Valls Guimerà  wrote:

> At http://incf.org, we launched a Stackoverflow-like website to engage the
>
> neuroscientific community:
>
> http://neurostars.org
>
>
>
Just curious : Is this based on askbot? Or did you develop the whole thing?

-Venkat

-- 
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/CAN7tdFQsAwDVw6yWD1-zVjfUXQZvPgSN74qe3FGUcYPhKcbfUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simple User login not working.

2014-03-20 Thread C. Kirby
If you are using stock User accounts why are you writing a login view? Just 
use 

django.contrib.auth.views.login

You can pass it your own template in the url definition
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 
'login.html'}, name='login' )   


On Wednesday, March 19, 2014 3:21:09 PM UTC-5, Don Fox wrote:
>
> My project has two superusers who have access to the Django Administration 
> and who manually add about 15 Users who should then be able to login and 
> use the site to do data entry.
>
> I'm using the standard code in my views
>
>
> *def auth_view(request):*
> *username = request.POST.get('username',' ')*
> *password = request.POST.get('password',' ')*
> *user = auth.authenticate(username=username, password=password)*
>
> *if user is not None:*
> *auth.login(request, user)*
> *return HttpResponseRedirect('/accounts/loggedin')*
> *else:*
> *return HttpResponseRediredt('/accounts/invalid') *
>
>
> This should check against the users listed in the admin page?
>
>
> [image: ]
>
>
> However ther is no acknowledgement from the loggedin.hml template.
>
>
> Does anything come to mind that I have newgelected to do to get the login 
> to work.
>
>

-- 
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/959cd1ce-acc2-4f60-ba3b-576c53fa9c6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread C. Kirby
Are you building your own authentication system as a learning opportunity 
or to actually use in a production system? If it is for a production system 
then...don't. There is quite a bit of code in django Users to handle 
passwords and keep passwords safe and authentication secure.

If you want to expand on the User model or modify it then you should extend 
or substitute the existing User model 
(https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#extending-the-existing-user-model)

That page also has information about hooking into different authentication 
backends if you want to use an existing source of users (for instance to 
use LDAP or the like)



On Thursday, March 20, 2014 9:06:48 AM UTC-5, Aryak Sengupta wrote:
>
> I am new to Django (but not new to python) and I am looking forward to 
> create a customized  page using django.  I have read about django's inbuilt 
> authentication system but I want build it from scratch So here are the few 
> ideas I am stumbling upon :
>
>
>1. Creating a *users* class in the models.py with username and 
>password as the fields (both are CharField)
>
>2. Creating  two views one named *LoginView*, which will depict the 
>initial login page (such as a *form* imported from a *module named 
> forms.py*) and another view named *LoggedInView* which will show only 
>the username of the logged user
>
>3. Mapping them into corresponding URLs
>
> I tried creating it with above mentioned thoughts but I got stuck with an 
> error as follows:
>
> Forbidden (403)
>
> CSRF verification failed. Request aborted.
> Help
>
> Reason given for failure:
>
> CSRF cookie not set.
>
>
> I couldn't figure out why possibly I am getting this error for 
> incorporating such a simple(and basic) functionality.
>
> *I want to understand the best way/approach to go about this (for 
> implementing this functionality). I am not worrying about the error for the 
> time being since I didn't spend much time thinking about it (So I am not 
> posting any code). I want to get my approach right first. I want to be 
> flawless while implementing such basic and elementary stuffs.  *
>

-- 
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/fa3d5877-2098-4cb0-a2ae-8f503f24d517%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Custom User Admin Login

2014-03-20 Thread Alexander Myasnov


суббота, 21 декабря 2013 г., 15:50:15 UTC+4 пользователь 
vinaya...@iiitd.ac.in написал:
>
> Also, from initial tests it appears that django-guardian is not setting 
> permissions with custom user. I wrote a small manage.py script to test that:
>
> from django.core.management.base import BaseCommand, CommandError
> from iiitd.models import *
> from guardian.shortcuts import assign_perm, remove_perm
>
> class Command(BaseCommand):
> def handle(self, *args, **options):
> user = MyUser.objects.filter(username='abc')[0]
> stream = Stream.objects.filter(uuid='001')[0]
> assign_perm('read_stream', user, stream)
> print user.has_perm('read_stream', stream)
> remove_perm('read_stream', user, stream)
> print user.has_perm('read_stream', stream)
>
> It prints True in both cases.
> However, the guardian_userobjectpermission table is updating correctly 
> when I add or delete permissions. Confused. o.O
>


Hello, have you solved this bug?

Now I have the same behavior with django-1.6.2 and django-guardian-1.2.

-- 
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/2ef4cbac-f3cc-4d75-ad96-6c766a123261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I am unable to get the choice field to validate on creating users. it doesn't make sense at all.

2014-03-20 Thread sashank reddy
Hi Tom,

I did try an override meanwhile.

I added,

def initialize_designation(self):
print("Initializing designation")
self.desig_group = forms.ChoiceField(choices=choice_des())
return
to my form class.
This will override the desig_group that is previously declared.
I call this in the view after the form instance is created and assigned to 
form
form.initialize_designation()
I am getting the prints from the function meaning that the function is 
executed.
Still there is Validation error.

This should have worked right? Why dint this work?

Regards,
Preetam

On Thursday, 20 March 2014 17:12:07 UTC+5:30, Tom Evans wrote:
>
> On Thu, Mar 20, 2014 at 10:12 AM, sashank reddy 
> > wrote: 
> > Hi Tom, 
> > 
> > I have not understood what you have said. Shouldn't choice_desig be 
> called 
> > every time I instantiate it in the view with the form = New_user_form(). 
> I 
> > thought I was creating an object of New_user_form every time I do that. 
>
> This is pretty basic python, the function is run when python 
> interprets the class. 
>
> Eg, 
>
> class Foo(object): 
>   some_var = 'this is a string'.split() 
>
> The string is split only once, when the class Foo is parsed by python, 
> not whenever an instance of Foo is instantiated. Things that happen 
> when an instance is instantiated are contained in the __init__ method. 
>
> Although the some_var looks like it is just declaring a class 
> attribute, it is actually just running code in the scope of the class, 
> and as such you can write almost any code there (contrast with 
> definition of class variables in java). Eg this is perfectly valid: 
>
> class Foo(object): 
>   some_var = 'this is a string'.split() 
>   some_var = some_var[1:] 
>   some_var.sort() 
>
>
> Cheers 
>
> Tom 
>

-- 
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/3ea9b7b6-197f-4262-8a6c-1ac41a945cb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I am unable to get the choice field to validate on creating users. it doesn't make sense at all.

2014-03-20 Thread sashank reddy
Tom,

In addition it still doesn't explain why I am unable to traceback the point 
of exception.
How can there be an exception when the only thing there are are few perfect 
prints

I am always invariably getting the

"Validation completed print" 

for desig_name field.
Then I get

"BaseForm: _clean_fields: ValidationError for  desig_group"

It should actually be:
"
Field executing validators :
Running validators
Completed executing field validator"

It should atleast give the first 2 prints
The following are the prints in my core files Field class in 
django.forms.fields:

def validate(self, value):
if value in validators.EMPTY_VALUES and self.required:
raise ValidationError(self.error_messages['required'])
print("Validation complete")

def run_validators(self, value):
print("Running validators")
if value in validators.EMPTY_VALUES:
return
errors = []
for v in self.validators:
try:
v(value)
except ValidationError as e:
if hasattr(e, 'code') and e.code in self.error_messages:
message = self.error_messages[e.code]
if e.params:
message = message % e.params
errors.append(message)
else:
errors.extend(e.messages)
if errors:
raise ValidationError(errors)

def clean(self, value):
"""
Validates the given value and returns its "cleaned" value as an
appropriate Python object.

Raises ValidationError for any errors.
"""
value = self.to_python(value)
self.validate(value)
print("Field executing validators : ")
self.run_validators(value)
print("Completed executing field validator")
return value

On Thursday, 20 March 2014 23:11:24 UTC+5:30, sashank reddy wrote:
>
> Hi Tom,
>
> I did try an override meanwhile.
>
> I added,
>
> def initialize_designation(self):
> print("Initializing designation")
> self.desig_group = forms.ChoiceField(choices=choice_des())
> return
> to my form class.
> This will override the desig_group that is previously declared.
> I call this in the view after the form instance is created and assigned to 
> form
> form.initialize_designation()
> I am getting the prints from the function meaning that the function is 
> executed.
> Still there is Validation error.
>
> This should have worked right? Why dint this work?
>
> Regards,
> Preetam
>
> On Thursday, 20 March 2014 17:12:07 UTC+5:30, Tom Evans wrote:
>>
>> On Thu, Mar 20, 2014 at 10:12 AM, sashank reddy 
>>  wrote: 
>> > Hi Tom, 
>> > 
>> > I have not understood what you have said. Shouldn't choice_desig be 
>> called 
>> > every time I instantiate it in the view with the form = 
>> New_user_form(). I 
>> > thought I was creating an object of New_user_form every time I do that. 
>>
>> This is pretty basic python, the function is run when python 
>> interprets the class. 
>>
>> Eg, 
>>
>> class Foo(object): 
>>   some_var = 'this is a string'.split() 
>>
>> The string is split only once, when the class Foo is parsed by python, 
>> not whenever an instance of Foo is instantiated. Things that happen 
>> when an instance is instantiated are contained in the __init__ method. 
>>
>> Although the some_var looks like it is just declaring a class 
>> attribute, it is actually just running code in the scope of the class, 
>> and as such you can write almost any code there (contrast with 
>> definition of class variables in java). Eg this is perfectly valid: 
>>
>> class Foo(object): 
>>   some_var = 'this is a string'.split() 
>>   some_var = some_var[1:] 
>>   some_var.sort() 
>>
>>
>> Cheers 
>>
>> Tom 
>>
>

-- 
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/0b862845-1767-4d66-8e15-4ed413a376ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How allow public query & download of info from my db

2014-03-20 Thread Nicholas Tapia
Hey Django Community!

I'm newer to programming and was pointed in the direction of django for 
this project.

The idea is that people can make their own custom queries and download load 
it from my db.

So far I'm thinking that using a form is they way to go to accept this 
information.  But from there I'm a little confused.  Does a custom model 
need to be created automatically before that query can be requested and 
displayed?  Or can model be skipped in this case?

Thank you Django Community!

-Nicholas

-- 
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/47751b42-0ff7-465a-8dda-337d3e8d9d5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


adding a layer on a shapefile and then displaying map on a html page.

2014-03-20 Thread Nicholas Perez
Hello All.
I wanted to ask anyone who can help me with two issues.
First off, i am using goeodjango to upload a shape file of new york state 
to my admin page.
Next i wanted to add a layer on top of that file that has locations for 
movies, restaurants, etc ON TOP of the file i have.
Is it possible to do so or do i have to create another models.py file to 
deal with that.

Lastly once i have the file with the layers that i want, how can i show it 
on html.page 
This is where i am hitting a wall.

Please let me know how to proceed forward. Thank You for your time.

ps: below is the set up i am currently using
Django/geodjango v.1.6.2
Database: postrgreSQL with postGIS
platform:widnows


-- 
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/d3b1cf31-74fb-4dcd-90cb-b7e8bb4596f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Tutorials: NoReverseMatch at /polls/1/vote/

2014-03-20 Thread wasingej
I am trying to create the project described by the Django Tutorials. 
 However, I have reached a problem that I am stuck on after implementing 
the voting forms described in tutorial 4 
(https://docs.djangoproject.com/en/1.6/intro/tutorial04/).  When I run my 
website and go to the url:http://localhost:8000/polls/1/vote/, I am greeted 
with an exception:

NoReverseMatch at /polls/1/vote/
value: u'polls' is not a registered namespace

here is templates/polls/detail.html:


{{ poll.question }}

{% if error_message %}{{ error_message }}{% endif %}

 <
{{ choice.choice_text 
}}
{% endfor %}




This template is rendered from this view in polls/views.py:

def vote(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
try:
selected_choice = p.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
# Redisplay the poll voting form.

return render(request, 'polls/detail.html', {
'poll': p,
'error_message': "You didn't select a choice.",
})
else:
selected_choice.votes += 1
selected_choice.save()
# Always return an HttpResponseRedirect after successfully dealing
# with POST data. This prevents data from being posted twice if a
# user hits the Back button.
return HttpResponseRedirect(reverse('polls:results', args=(p.id,)))




It seems strange that 'polls' is not a registered namespace because it is 
the name of my django application.  Any ideas as to what I could be doing 
wrong here?

-- 
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/c8050fdc-38eb-43ed-b77a-ee5a2c872509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-20 Thread Russell Keith-Magee
On Thu, Mar 20, 2014 at 6:50 PM, Venkatraman S  wrote:

>
> On Sat, Mar 15, 2014 at 7:11 AM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>>
>> On Sat, Mar 15, 2014 at 7:19 AM, Jonathan Baker <
>> jonathandavidba...@gmail.com> wrote:
>>
>>> Does that mean that the default="" functionality is implemented by the
>>> ORM, instead of in the database layer?
>>>
>>> This is correct - Django's "default" argument is an API level default,
>> not a database level default.
>>
>>
> @Russ, any specific reasons for this choice?
>

Honestly - not a clue. It was like that when I got here, so the reasons are
probably lost in the depths of time. :-)

Trying to reverse engineer the decision, the most likely reason is that
Django has allowed callable defaults; if you define a callable in your
Django model as a default, there's no way to pass this down to the database
(or, at least, not an easy way).

Yours,
Russ Magee %-)

-- 
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/CAJxq848nGKNY%2B4tpfPK80sOT1gwPocvR%2BPbrs6jeQiUcOv1mew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-20 Thread Mike Dewhirst

On 21/03/2014 11:13am, Russell Keith-Magee wrote:


On Thu, Mar 20, 2014 at 6:50 PM, Venkatraman S mailto:venka...@gmail.com>> wrote:


On Sat, Mar 15, 2014 at 7:11 AM, Russell Keith-Magee
mailto:russ...@keith-magee.com>> wrote:


On Sat, Mar 15, 2014 at 7:19 AM, Jonathan Baker
mailto:jonathandavidba...@gmail.com>> wrote:

Does that mean that the default="" functionality is
implemented by the ORM, instead of in the database layer?

This is correct - Django's "default" argument is an API level
default, not a database level default.


@Russ, any specific reasons for this choice?


Honestly - not a clue. It was like that when I got here, so the reasons
are probably lost in the depths of time. :-)


If some things are done in the database and some in the ORM, developer 
madness ensues.


I think keeping everything in the ORM is entirely manageable for 
programmers. Tweaking the database is last straw optimisation.


Mike



Trying to reverse engineer the decision, the most likely reason is that
Django has allowed callable defaults; if you define a callable in your
Django model as a default, there's no way to pass this down to the
database (or, at least, not an easy way).

Yours,
Russ Magee %-)

--
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/CAJxq848nGKNY%2B4tpfPK80sOT1gwPocvR%2BPbrs6jeQiUcOv1mew%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/532B8936.4090502%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


[ANNOUNCE] Django 1.7 beta 1 released

2014-03-20 Thread James Bennett
We're getting closer to 1.7!

Details in the blog post here:

https://www.djangoproject.com/weblog/2014/mar/20/django-17b1/

-- 
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/CAL13Cg-n0cg_zxjEm%3Dhe4JrVY2dGzLk%2BZ%2B-eNuKjSv%2ByjVSOTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


how to fix the OSerror[Errno 5] input/output error when deploy django project with uwsgi and nginx?

2014-03-20 Thread jie . li0117


My enviorent is :ubuntu 12.04, django 1.6.1 python 3.3.4 nginx 1.4.7 and 
uwsgi 2.0.2 The problem came when I registered a new user,Exception 
location is where the code is "if form.is_valid()".

Exception value:[Errno 5] Input/output error

I just test it with the django's development server, NO ERROR!

SO I think the problem lies somewhere with uwsgi or Nginx?

my code dealing with the registration is :

def register(request):
form = UserCreationForm()
action = "注册"
template_name='accounts/auth_form.html' if request.is_ajax() else 
'accounts/auth.html'
if request.method == "POST":
form = UserCreationForm(data=request.POST)
 ***if form.is_valid():#Exception here***
form.save(request=request)
username=request.POST.get('username')
email_domain=request.POST.get('email').split('@')[1]
if request.is_ajax():
return 
TemplateResponse(request,"accounts/register_feedback.html",locals())  
else:
return 
TemplateResponse(request,"accounts/register_feedback.html",locals())
return TemplateResponse(request,template_name,locals())   

Then my uwsgi configuration is just like what the django document provides:

[uwsgi]
socket = 127.0.0.1:3031
chdir = /home/fox/KuaiPan/fox/
pythonpath = ..
env = DJANGO_SETTINGS_MODULE=myauth.settings
module = django.core.handlers.wsgi:WSGIHandler()
processes = 4
threads = 2
stats = 127.0.0.1:9191

This problelm is really annoying,how to fix it? THX 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/84c75d4d-665b-4c2c-bd38-40d5969a30a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


how to fix the OSerror[Errno 5] input/output error when deploy django project with uwsgi and nginx?

2014-03-20 Thread jie . li0117


My enviorent is : UBUNTU 12.04, django 1.6.1 python 3.3.4 nginx 1.4.7 and 
uwsgi 2.0.2 The problem came when I registered a new user,Exception 
location is where the code is "if form.is_valid()".

Exception value:[Errno 5] Input/output error

I just test it with the django's development server, NO ERROR!

SO I think the problem lies somewhere with uwsgi or Nginx?

my code dealing with the registration is :

def register(request):
form = UserCreationForm()
action = "注册"
template_name='accounts/auth_form.html' if request.is_ajax() else 
'accounts/auth.html'
if request.method == "POST":
form = UserCreationForm(data=request.POST)
 ***if form.is_valid():#Exception here***
form.save(request=request)
username=request.POST.get('username')
email_domain=request.POST.get('email').split('@')[1]
if request.is_ajax():
return 
TemplateResponse(request,"accounts/register_feedback.html",locals())  
else:
return 
TemplateResponse(request,"accounts/register_feedback.html",locals())
return TemplateResponse(request,template_name,locals())   

Then my uwsgi configuration is just like what the django document provides:

[uwsgi]
socket = 127.0.0.1:3031
chdir = /home/fox/KuaiPan/fox/
pythonpath = ..
env = DJANGO_SETTINGS_MODULE=myauth.settings
module = django.core.handlers.wsgi:WSGIHandler()
processes = 4
threads = 2
stats = 127.0.0.1:9191

This problelm is really annoying,how to fix it? THX 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/7f660270-47dc-4f40-8be8-e3c945bc6014%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Yes I was trying to implement it for learning django properly. Alright , I
got your point.


On Thu, Mar 20, 2014 at 9:55 PM, C. Kirby  wrote:

> Are you building your own authentication system as a learning opportunity
> or to actually use in a production system? If it is for a production system
> then...don't. There is quite a bit of code in django Users to handle
> passwords and keep passwords safe and authentication secure.
>
> If you want to expand on the User model or modify it then you should
> extend or substitute the existing User model (
> https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#extending-the-existing-user-model
> )
>
> That page also has information about hooking into different authentication
> backends if you want to use an existing source of users (for instance to
> use LDAP or the like)
>
>
>
>
> On Thursday, March 20, 2014 9:06:48 AM UTC-5, Aryak Sengupta wrote:
>>
>> I am new to Django (but not new to python) and I am looking forward to
>> create a customized  page using django.  I have read about django's inbuilt
>> authentication system but I want build it from scratch So here are the few
>> ideas I am stumbling upon :
>>
>>
>>1. Creating a *users* class in the models.py with username and
>>password as the fields (both are CharField)
>>
>>2. Creating  two views one named *LoginView*, which will depict the
>>initial login page (such as a *form* imported from a *module named
>> forms.py*) and another view named *LoggedInView* which will show
>>only the username of the logged user
>>
>>3. Mapping them into corresponding URLs
>>
>> I tried creating it with above mentioned thoughts but I got stuck with an
>> error as follows:
>>
>> Forbidden (403)
>>
>> CSRF verification failed. Request aborted.
>> Help
>>
>> Reason given for failure:
>>
>> CSRF cookie not set.
>>
>>
>> I couldn't figure out why possibly I am getting this error for
>> incorporating such a simple(and basic) functionality.
>>
>> *I want to understand the best way/approach to go about this (for
>> implementing this functionality). I am not worrying about the error for the
>> time being since I didn't spend much time thinking about it (So I am not
>> posting any code). I want to get my approach right first. I want to be
>> flawless while implementing such basic and elementary stuffs.  *
>>
>  --
> 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/fa3d5877-2098-4cb0-a2ae-8f503f24d517%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/CALTbq1wS_feOyHp-b8Yn6ZgRNhB_wHtXpLome5TJA6nar0S0rQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.