problems with errors in templates

2011-04-17 Thread Antonio Sánchez
hi, im working with a modelform, and overrided clen methos for making
some custom checks, raising a forms.ValidationError when i need, im
sure this error is raised, but i dont know why in the template errors
are not showed (instead of form is showed again cause it's not
valid!), here is some of the code: http://pastebin.com/j2SvJYgA  some
help, thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problems with errors in templates

2011-04-18 Thread Antonio Sánchez
thanks, i think you are right, but now i cant check it, i'll do it
later!

thanks!

On 17 abr, 23:00, Daniel Roseman  wrote:
> On Sunday, 17 April 2011 21:41:15 UTC+1, Antonio Sánchez wrote:
>
> > hi, im working with a modelform, and overrided clen methos for making
> > some custom checks, raising a forms.ValidationError when i need, im
> > sure this error is raised, but i dont know why in the template errors
> > are not showed (instead of form is showed again cause it's not
> > valid!), here is some of the code:http://pastebin.com/j2SvJYgA some
> > help, thanks
>
> With that code, if the form is not valid and `new` is None, the form will be
> re-instantiated without any bound data. Replace `if new is None` with `elif
> new is None`.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



extend User Model for custom fields

2011-03-25 Thread Antonio Sánchez
hi! i have a question, which is the best option about extending user model?? 

here: 
http://docs.djangoproject.com/en/1.2//topics/auth/#storing-additional-information-about-users
 
they say to create a manual OneToOneField between models and some more 
stuff, 
but here: 
http://docs.djangoproject.com/en/1.2//topics/db/models/#multi-table-inheritance 
it says that with inheritance this 1:1 relationship is created 
automatically, both are in django docs

appart from this, i have read a lot ways, some people inherit, other use 
foreign key, ones redefines django's authentication backend other rewrites 
pre-save/save methods... :S ... so, which way do you think is better (some 
tutorial/blog post/something)?? thanks! 
djjango’s authentication backend.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extend User Model for custom fields

2011-03-25 Thread Antonio Sánchez
i have found this: 
http://digitaldreamer.net/blog/2010/12/8/custom-user-profile-and-extend-user-admin-django/
do you think its the correct way??

thanks for your reply!

On Mar 25, 2:12 pm, Calvin Spealman  wrote:
> The auth app includes support to use a profile model, configured with
> AUTH_PROFILE_MODULE in settings, which the docs show you how to use.
> Yes you can use inheritance, but you might assume it is a good idea to
> use what the auth app promotes.
>
>
>
> On Fri, Mar 25, 2011 at 9:04 AM, Antonio Sánchez  
> wrote:
>
> > hi! i have a question, which is the best option about extending user model??
> > here:
> >http://docs.djangoproject.com/en/1.2//topics/auth/#storing-additional...
> > they say to create a manual OneToOneField between models and some more 
> > stuff,
> > but here:
> >http://docs.djangoproject.com/en/1.2//topics/db/models/#multi-table-i...
> > it says that with inheritance this 1:1 relationship is created 
> > automatically, both are in django docs
>
> > appart from this, i have read a lot ways, some people inherit, other use 
> > foreign key, ones redefines django's authentication backend other rewrites 
> > pre-save/save methods... :S ... so, which way do you think is better (some 
> > tutorial/blog post/something)?? thanks!
>
> > djjango’s authentication backend.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.> To post to this group, send email 
> > todjango-us...@googlegroups.com.> To unsubscribe from this group, send 
> > email todjango-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Read my blog! I depend on your acceptance of my opinion! I am 
> interesting!http://techblog.ironfroggy.com/
> Follow me if you're into that sort of thing:http://www.twitter.com/ironfroggy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extend User Model for custom fields

2011-03-26 Thread Antonio Sánchez
Yeah sure, i should have used "recommended" word instead of correct.

The difference between link i wrote and b-list is that the last one
uses a foreign-key, while first uses one-to-one, and this is the way
is recommended in doc, so... I think i will follow that post
recommendations.

Thanks again!

p.d.: in this case, recommendation is not no use heritange, but, in
cases where i want to extend ANOTHER app (3rd apps), how do you do it?
using inheritange?

On Mar 25, 9:30 pm, Mike Ramirez  wrote:
> On Friday, March 25, 2011 01:16:51 pm Nick Serra wrote:> Andre's solution is 
> out of date. Calvin is correct, use the user
> > profile model that is built into django auth. OP, the link you found
> > is correct.
>
> > >http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m...
>
> > > > > > here:
> > > > > >http://docs.djangoproject.com/en/1.2//topics/auth/#storing-
>
> additional-information-about-users
>
> and:
>
> http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-
> information-about-users
>
> What's different about these pages, except that b-list goes into a bit more
> detail?
>
> Hint: Nothing.
>
> But I don't think there is a "correct" way, just a recommended way.  I use the
> recommended way, but it's definately not the only way or 'better'.  'correct',
> 'better' in this case are subjective to the needs of the dev and/or project.
>
> Mike.
>
> --
> Reality is just a convenient measure of complexity.
>                 -- Alvy Ray Smith

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



extending django-registration forms

2011-04-06 Thread Antonio Sánchez
Hi, im having problems extending django-registration register form. i
have extended auth.User -> UserProfile, and added some attributes, one
of this is country, that is a ForeignKey to Country Table (Django-
Countries, with all countries).

After configuring django-registration, i extend register form , one of
the new fields is a forms.ModelChoiceField with queryset
Country.objects.all(), after that, i configure in a new file a new
funtion that connects
with user_registered signal.

All works if i dont put Country field in the extended form, but if i
do it, fails.. :
__init__() got multiple values for keyword argument 'queryset'

here are portions of this code: http://pastebin.com/LfNJisg8

some help?? thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extending django-registration forms

2011-04-07 Thread Antonio Sánchez
i have tried a lot things, but nothing works... only when i delete
that field, so that is the problem, but i dont know why!?!? :S

On 6 abr, 22:29, Antonio Sánchez  wrote:
> Hi, im having problems extending django-registration register form. i
> have extended auth.User -> UserProfile, and added some attributes, one
> of this is country, that is a ForeignKey to Country Table (Django-
> Countries, with all countries).
>
> After configuring django-registration, i extend register form , one of
> the new fields is a forms.ModelChoiceField with queryset
> Country.objects.all(), after that, i configure in a new file a new
> funtion that connects
> with user_registered signal.
>
> All works if i dont put Country field in the extended form, but if i
> do it, fails.. :
> __init__() got multiple values for keyword argument 'queryset'
>
> here are portions of this code:http://pastebin.com/LfNJisg8
>
> some help?? thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problems with redirect function

2011-04-10 Thread Antonio Sánchez
hi, im trying to use redirect shortcut, but im having problems passing
arguments to the view i want to reverse.

view definition is this:

def profile(request, activation_key=None, new=None):
if new is None:
return HttpResponse("You're at the profile.")
else:
return HttpResponse("New User!\nYou're at the profile.")


my urls looks like this (and works):
url(r'^profile/(?P\w+)/$', profile, {'new': 1},
name='profile_view'),

but in other view, i try to use redirect, doing this:

kwargs['new'] = 1
return redirect(success_url, **kwargs)



I add 'new' parameter and sets it to 1 (just like in url definition!),
but it fails:
Reverse for 'profile_view' with arguments '()' and keyword arguments
'{'new': 1, 'activation_key':
u'ad6ef997beccb16dee9184d1602dad086dfa1b97'}' not found.

the point is that if i delete that param (new), from view definition,
url, and dont add in the view calls return, it works...

some idea??
thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problems with redirect function

2011-04-11 Thread Antonio Sánchez
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#redirect

"You can use the redirect() function in a number of ways.
2. By passing the name of a view and optionally some positional or
keyword arguments; the URL will be reverse resolved using the
reverse() method"

I think it's possible, but i cant do it work!

On Apr 11, 12:42 pm, Daniel Roseman  wrote:
> On Monday, April 11, 2011 12:00:37 AM UTC+1, Antonio Sánchez wrote:
>
> > hi, im trying to use redirect shortcut, but im having problems passing
> > arguments to the view i want to reverse.
>
> > view definition is this:
>
> > def profile(request, activation_key=None, new=None):
> > if new is None:
> > return HttpResponse("You're at the profile.")
> > else:
> > return HttpResponse("New User!\nYou're at the profile.")
>
> > my urls looks like this (and works):
> > url(r'^profile/(?P\w+)/$', profile, {'new': 1},
> > name='profile_view'),
>
> > but in other view, i try to use redirect, doing this:
> > 
> > kwargs['new'] = 1
> > return redirect(success_url, **kwargs)
> > 
>
> > I add 'new' parameter and sets it to 1 (just like in url definition!),
> > but it fails:
> > Reverse for 'profile_view' with arguments '()' and keyword arguments
> > '{'new': 1, 'activation_key':
> > u'ad6ef997beccb16dee9184d1602dad086dfa1b97'}' not found.
>
> > the point is that if i delete that param (new), from view definition,
> > url, and dont add in the view calls return, it works...
>
> > some idea??
> > thanks!
>
> What you are trying to do makes no sense. Redirection sends the browser to
> another URL. The only parameters that are possible are those in the URL
> itself. For whatever reason, you have not put your `new` parameter in the
> URL, but hard-coded it in urls.py. If you need to pass a parameter, put it
> into the URL (or, alternatively, store it in the session).
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.