Re: Django or python question about classes

2011-11-30 Thread youpsla
Thanks for the link Tom. I'll read that in details later (it's a little bit complicated) an for my POC I'll just use a not DRY method !!! :-) Regards Youpsla On 28 nov, 17:16, Tom Evans <tevans...@googlemail.com> wrote: > On Mon, Nov 28, 2011 at 4:07 PM, youpsla <youp...@gmai

Django or python question about classes

2011-11-28 Thread youpsla
Hello, in my code, I like to overrride the form_valid() method in both CreateView and UpdateView generic class views. I've put my code in views.py. class MyCreateView(UpdateView): . def form_valid(self, form, **kwargs): some code class MyUpdateView(CreateView): .

Re: Reverse and variables in template

2011-11-24 Thread youpsla
Thnaks a lots, it works. Youpsla -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZATE6UT7dWwJ. To post to this group, send email to dj

Reverse and variables in template

2011-11-24 Thread youpsla
precious help. Regards youpsla -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1IxshdRdwksJ. To post to this group, send email to dj

Re: 'function' object has no attribute 'as_view'

2011-11-23 Thread youpsla
Thanks for all. Agai I apologize for not having post this "etail" in my originl post. Regards Alain -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: 'function' object has no attribute 'as_view'

2011-11-23 Thread youpsla
Hello all, I've verified that I don't override the class. I've found the reason of the bug. When I delete "@login_required", it works. My class was in view.py: @login_required class EvenementCreateView(.): . I apologize for not have copy/paste that in my first post. I've done the

Re: 'function' object has no attribute 'as_view'

2011-11-23 Thread youpsla
Hi again, yes I'm sure the error comes from here. Bellow is the full trace back: Environment: Request Method: GET Request URL: http://127.0.0.1:8010/magasin/ Django Version: 1.3.1 Python Version: 2.7.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes',

Re: 'function' object has no attribute 'as_view'

2011-11-23 Thread youpsla
Hi, thnaks for your answer. It's the same. it doesn't work. For information I use generic view for other part of the site with: url(r"magasin/(?P\d+)/supprimer/$", DeleteView.as_view(model=Magasin, success_url="/magasins/liste"), name='magasin_supprimer'), and it works fine. And has you say,

'function' object has no attribute 'as_view'

2011-11-23 Thread youpsla
Hello, the issue here seems to be trivial, maybe I got something in my eyes, but I can't find the solution. Here is my code: urls.py url(r"magasin/(?P\d+)/evenement/new/$", EvenementCreateView.as_view(model=Evenement), name='new_evenement_magasin'), views.py: class

Re: Manage exception from external services in a form

2011-11-15 Thread youpsla
nov, 05:08, youpsla <youp...@gmail.com> wrote: > Hello, > I hope, despite my poor english, to be enough clear. > > In my Django app, users fill a form with adress, Zip, CIty > informations. > > I like to geocode those informations to fill the lat and lng field of > th

Manage exception from external services in a form

2011-11-15 Thread youpsla
Hello, I hope, despite my poor english, to be enough clear. In my Django app, users fill a form with adress, Zip, CIty informations. I like to geocode those informations to fill the lat and lng field of the table db. FOt this tak I use geocoders method from geopy module. It works fine if Google

Re: Project general design question - "From scratch" or use of admin interface

2011-11-07 Thread youpsla
<russ...@keith-magee.com> wrote: > On Mon, Nov 7, 2011 at 8:06 PM, youpsla <youp...@gmail.com> wrote: > > Hi, > > before getting more in depth in writing my project I ask you a general > > design question. My Django knowledge is not BIG enough for me to b

Project general design question - "From scratch" or use of admin interface

2011-11-07 Thread youpsla
Hi, before getting more in depth in writing my project I ask you a general design question. My Django knowledge is not BIG enough for me to be able to have a clear answer (with for and cons) on my question. Here are the main guidelines of my project : - I've two kind of users : Shop owners and

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread youpsla
; Customer has 0 categories, it will write once (INSERT at bottom of > program). If the Customer has n categories, it will only write once > (INSERT) in the loops, and write once (UPDATE) at the bottom of the program. > > That is why it is much quicker running it this way. > > Cheers

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread youpsla
form.cleaned_data.iteritems(): >                 if field == 'category' and instance.id == None: # if this > is a category, and the instance has not yet been saved, save it so it has > an id. >                     instance.save() >                 setattr(instance, field, value) >

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread youpsla
ield/value pairs, this is brute force (not very > scalable for large number of fields), but should work. Anybody else please, > show code that could get the specific forms and field/values for categories. > > Furbeenator > > > > > > > > On Wed, Nov 2, 201

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread youpsla
scalable for large number of fields), but should work. Anybody else please, > show code that could get the specific forms and field/values for categories. > > Furbeenator > > > > > > > > On Wed, Nov 2, 2011 at 10:28 AM, youpsla <youp...@gmail.com> wrote: >

Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread youpsla
Hello, i'm currently doning a website where user can register (without password, without auth module of Django). They put some informations and at the end (Step5Form) do multiple choices by clicking on checkboxes. When I click on validate on the last step I've "instance needs to have a primary key

Re: Formwizard - Validation with a database lookup

2011-10-25 Thread youpsla
Customer__email_adresse__exact= self.cleaned_data['email_adresse'] raise forms.ValidationError(u'Cette adresse Email est deja utilisee') return self.cleaned_data except: pass If you have beter idea. regards Alain Entry.objects.filter(blog__name__exact='Beatles Blog') On 25 oct, 21:01, you

Formwizard - Validation with a database lookup

2011-10-25 Thread youpsla
Hello, I've setup a 5 steps form (There is only one table in the database). In the first step I ask for Email adresse. I ike this to be unique in the database. By putting parameters "unique=True" in models, the error only raise when submitting the form at the last step. Is there a way to do the

ModelForm - formwizard - Form on multiple pages

2011-10-22 Thread youpsla
Hello, I'm buiding a website where users hae t fill a form. It's not a really big one but I like to split it on multiple pages. I can build the database with only one big table but I prefer for update (index) reason split in 3 or 4 tables. (Maybe you'll find some quetions like beginners one ...

Re: Django 1.3.1 - Form on multiple pages

2011-10-21 Thread youpsla
.3 documents, just make sure you change that "dev" in the URL > to "1.3". Don't worry, it happens a lot more often that you might think! > > > > > > > > On Fri, Oct 21, 2011 at 7:44 PM, youpsla <youp...@gmail.com> wrote: > > Hi again,

Re: Django 1.3.1 - Form on multiple pages

2011-10-21 Thread youpsla
you're not reading the Development docs. It's > a different class all together in there. > > > > > > > > On Fri, Oct 21, 2011 at 7:02 PM, youpsla <youp...@gmail.com> wrote: > > Sorry, I think I was wrong. I try to use SessionWizardView wich > > require ton

Re: Django 1.3.1 - Form on multiple pages

2011-10-21 Thread youpsla
ject.com/en/1.3/ref/contrib/formtools/form-wizard/ > > I don't believe it's deprecated in 1.3.1 but I could be wrong... > > > > > > > > On Fri, Oct 21, 2011 at 6:04 PM, youpsla <youp...@gmail.com> wrote: > > Hello, > > I like to know wich is the best

Django 1.3.1 - Form on multiple pages

2011-10-21 Thread youpsla
Hello, I like to know wich is the best splution to manage one form on multiple pages with Gjango 1.3.1. I've seen in the doc that there is a FormWizard Session or Cookies) wich seems to be deprecated. Then, is there a new mechanics for the 1.3.1 version ? Thanks for your answers. Regards

Re: models.Model

2011-10-17 Thread youpsla
Hello Daniel thanks for your answer and sorry for my english. As you said, it could be a problem of translation !!! :-) I really appreciate your help, I'm doing lots of progress in my python object programming curve ... OK, then to be sure how Python works ... let see this code: 1 from

Re: models.Model

2011-10-17 Thread youpsla
e and last_name are instances of CharField. > > There's no functional programming here. > > -WN. > > > > > > > > On Sun, Oct 16, 2011 at 6:43 PM, youpsla <youp...@gmail.com> wrote: > > 1 from django.db import models > > 2 > > 3 class Person(

Re: models.Model

2011-10-17 Thread youpsla
ebb Newbie <new...@avatarific.com> wrote: > "models" is a module that contains classes Model and CharField. > > Person inherits from Model. > > first_name and last_name are instances of CharField. > > There's no functional programming here. > > -WN. > > &

models.Model

2011-10-16 Thread youpsla
Hello, I'm new to Django and I've only a medium background in funtionnal programming in Python. I'm currently reading and working on the Django tutorial. I've few questions on a example of code because things are not so clear for me. Here is the code example 1 from django.db import models 2 3