Re: set_cookie raise exception when the value contains Unicode charset

2017-01-29 Thread Xx Johnsua
But I never change the DEFAULT_CHARSET , this is my diffsettings: $ ./manage.py diffsettings AUTH_PASSWORD_VALIDATORS = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'd

Installing Django

2017-01-29 Thread Danny Jr Chu
Guys, please help. I am new with Python and Django, I mean I don't have any clue what's going on (don't even know how to encode), but I wish I could build a website out of my imaginary. I know this will goes miles and miles... I am trying to install Django but couple of errors occur : PS C:\Us

Re: form_invalid

2017-01-29 Thread Norberto Bensa
BTW, IIRC, you can also make your model fields required (for db consistency) but then you need to use django.forms.Form instead of django.forms.ModelForm. 2017-01-30 0:08 GMT-03:00 Norberto Bensa : > Then you need to make your model fields not required and override your > form.clean() methods, t

Re: form_invalid

2017-01-29 Thread Norberto Bensa
Then you need to make your model fields not required and override your form.clean() methods, then you'll have complete control over the validation process. I see Melvyn already aswered. 2017-01-29 18:04 GMT-03:00 Roberto Russi : > But fields are required! I need to have a control over form also

Re: Issue with Tutorial pt 5 "Fixing the bug"

2017-01-29 Thread Melvyn Sopacua
On Tuesday 24 January 2017 11:14:58 Tim Graham wrote: > Correct, you shouldn't declare class QuestionAdmin(...) twice. What > problem do you see if you combine those classes? It's unlikely > related to your Python version. > > On Tuesday, January 24, 2017 at 10:45:50 AM UTC-5, John Wall wrote: > >

Re: set_cookie raise exception when the value contains Unicode charset

2017-01-29 Thread Melvyn Sopacua
On Sunday 29 January 2017 13:03:34 Xx Johnsua wrote: > File > "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versi o > ns/3.5/lib/python3.5/wsgiref/headers.py", line 142, in __bytes__ > return str(self).encode('iso-8859-1') https://docs.djangoproject.com/en/1.10/ref/settings/#

Re: Django Debug Toolbar installation

2017-01-29 Thread Melvyn Sopacua
On Sunday 29 January 2017 09:48:31 Richard Jackson wrote: > Hi Vijay - that's going to be the problem; I've installed it locally > but haven't installed it on my (Webfaction-provided) server. So don't add it to installed apps. One common pattern is to only enable debug tools when settings.DEBUG i

Re: form_invalid

2017-01-29 Thread Melvyn Sopacua
On Sunday 29 January 2017 04:10:20 Roberto Russi wrote: > I need get data from a form when submit is clicked even if data are > invalid, inconplete or empty. > I try to override form_invalid in CreateView but it is never called > and form_valid, obviously, only if data are valid. > Why form_invalid

Re: form_invalid

2017-01-29 Thread Roberto Russi
But fields are required! I need to have a control over form also if 'save' button is clicked and required fields are not filled. Il giorno domenica 29 gennaio 2017 20:26:10 UTC+1, Norberto Bensa ha scritto: > > Are you telling me the following doesn't work for you? > > class DemoCreateView(Crea

set_cookie raise exception when the value contains Unicode charset

2017-01-29 Thread Xx Johnsua
Hello everyone, Following is my code: def post(self, request, *args, **kwargs): self.object = self.get_object() form = forms.CommentForm(request.POST or None) if form.is_valid(): response = self.form_valid(form) return self._set_cookies(response, form) ... @transactio

Re: form_invalid

2017-01-29 Thread Norberto Bensa
Are you telling me the following doesn't work for you? class DemoCreateView(CreateView): ... def post(self, request, *args, **kwargs): print(request.POST) return super().post(request, *args, **kwargs) ... Now, at the console: ... BTW, I had to add "blank=True, null=True" t

Re: form_invalid

2017-01-29 Thread Roberto Russi
I have tried it but post method is called only if form is valid and not if there are mandatory field not filled. Il giorno domenica 29 gennaio 2017 18:30:50 UTC+1, Norberto Bensa ha scritto: > > https://ccbv.co.uk is your friend with class based views. > > I'd override post(self, request, *arg

Re: Django Debug Toolbar installation

2017-01-29 Thread Richard Jackson
Hi Vijay - that's going to be the problem; I've installed it locally but haven't installed it on my (Webfaction-provided) server. Thanks, Rich On Saturday, January 28, 2017 at 4:58:56 PM UTC, Vijay Khemlani wrote: > > Did you install debug_toolber on your server? > > pip install django-debug-t

Re: form_invalid

2017-01-29 Thread Norberto Bensa
https://ccbv.co.uk is your friend with class based views. I'd override post(self, request, *args, **kwargs), in request.POST, you'll have your form's data (before it's validated). HTH, Norberto 2017-01-29 9:10 GMT-03:00 Roberto Russi : > I need get data from a form when submit is clicked even i

Re: Wiring django-channels to html without javascript?

2017-01-29 Thread Avraham Serour
Yes, the client application connecting to the websocket server can be an user using an interactive console, a python application or any other software in any language. But if your objective is to have a webpage then no, unfortunately web browsers can only run javascript, if you really dislike java

Wiring django-channels to html without javascript?

2017-01-29 Thread Nikoleta Misheva
I used the console to test my app but now I want to wire my django-channels app to the html but I don't know any JS so is it possible to wire django-channels to html without using javascript? If it is possible how? Here you can

form_invalid

2017-01-29 Thread Roberto Russi
I need get data from a form when submit is clicked even if data are invalid, inconplete or empty. I try to override form_invalid in CreateView but it is never called and form_valid, obviously, only if data are valid. Why form_invalid is never called? I have this test project with django 1.10.5

Re: limiting the drop down option of a one-to-one relationship in the admin app. is that possible ?

2017-01-29 Thread Melvyn Sopacua
On Saturday 28 January 2017 21:48:03 Mike08 wrote: > Ok that makes sense. > > Now I have something like this > > class modelStudentAdmin(admin.ModelAdmin): > form = modelStudentAdminForm > > #Only display students that belong to this user > def get_queryset(self, request): >