Re: customization using form_class with generic views

2009-07-26 Thread Frédéric Hébert
Hi, AFAICS, it's nearly impossible to do this in the way you want to. set_pub_date is an another view which does a CRUD operation like generic view create_object and you pass it to extra_context which is relevant to a template operation. extra_context declares new objects in the template and i

Re: problem with milliseconds and mysql database

2009-07-25 Thread Frédéric Hébert
Hi, could you be more explanatory in your question ? How do you set your field value ? via a models.DateTimeField ? About the example that you 've given : is it the solution or what's giving the error ? I've tried your example and it works fine. Try to look for answers in django.db.fields.__i

Re: How to create this filter

2009-07-24 Thread Frédéric Hébert
It seems to me that you have to transform your fields lookup like that : col1_value >= col2_value * 2 something like col1__gte=F('col2') * 2 Frédéric 2009/7/24 David : > > Hello, > > Here is a table "myTable" with columns of "col1", "col2", "col3", ..., > "col5". The types of these columns ar

Re: Bug when creating Q object from string representation of another Q object?

2009-07-22 Thread Frédéric Hébert
You don't give us enough explanation about your error. What type of error have you got ? What is your orig variable ? How do you serialize your Q object ? Are you sure that a Q object can be instantiated like that ? Frédéric 2009/7/21 Margie : > > I have a situation where I want to do t

Re: Making Django ldapauth more sophisticated

2009-07-21 Thread Frédéric Hébert
On 21 juil, 00:35, "Daniele Procida" wrote: > I finally have ldapauth working now, and a user who is in our LDAP > database can connect as a Django User. > > But it's not entirely satisfactory. Before the LDAP user becomes a > Django User they have to try logging (which fails of course). Are y

AnonymousUser and groups attribute

2009-07-21 Thread Frédéric Hébert
Hi there, I've a context_processor to automatically add to each template a object which says to me if a given user is memeber of an admin group. It works fine when user is authenticated (whichever groups he belongs to) but raise an AttributeError when user is not. "Nonetype has no attribute _me

Re: urls.py error: unbalanced parenthesis

2009-07-19 Thread Frédéric Hébert
2009/7/19 Rob B (uk) : > > Getting a unblanced parenthesis error with this urls setup. Not sure > why. The message is pretty self-explanatory. It seems to me that you have forgotten a parenthesis after your first symbolic group named year. Frédéric > urls.py: > from django.conf.urls.defaults im

[Resolved] Re: Nested views and urls patterns declaration order

2009-07-13 Thread Frédéric Hébert
Hi, > Try adding a '^' character to the front of your regular expressions, > and see if the requests are passed to the proper views. thanks a lot, it works. > In your 'bad' situation, a url like "ue/reservations/xyz" gets matched > by the first regex, and passed to view_list_reservation (your i

Nested views and urls patterns declaration order

2009-07-13 Thread Frédéric Hébert
Hi there, first, here is my config: python 2.5.2 django 1.0.2 plateforme linux debian lenny I've two nested views, the inner of two using the list_detail.list generic view. The outter define a QuerySet and passes it to the inner view. When I declare the outter view after the inner in urls.p

Re: Problem with AD (LDAP) authentication

2009-07-08 Thread Frédéric Hébert
Hi, Maybe, should you put is_staff=True : http://docs.djangoproject.com/en/dev/topics/auth/#users Regards, Frédéric 2009/7/8 Technicalbard : > > I'm trying to write an Active Directory / LDAP authenication, and I'm > having problems.  The code is at: http://dpaste.com/hold/64752/ > > When

Catch an IntegrityError in views to get back pk value of prexisting model

2009-07-01 Thread Frédéric Hébert
_data1['nom']) -- CODE - But it seems that the uniqueness is validate before the call of model.save() and therefore before reaching DB. The form seems never validate even when the teacher did not exist in the DB. My question is : is the

Re: rollback transaction without an exception when transaction is tied to http requests

2009-06-25 Thread Frédéric Hébert
2009/6/26 sico : > > Hi > Hi > Is it possible to rollback the transaction without raising an > exception when the transactions are tied to http requests?? What do you mean ? You use raw sql in a view ? > I'm writing several records in one post call, if any fail I'd like to > rollback the tra

Re: MemoryError on bigs list of items

2009-06-25 Thread Frédéric Hébert
help, since if you're > restarting the process after just 1 request, any memory leaks won't > have time to build up. No, indeed. A MaxRequestPerChild set to 1 don't change anything Many thanks for your reply, > > -- Andrew > Frédéric > On Jun 25, 1:15 pm, F

MemoryError on bigs list of items

2009-06-25 Thread Frédéric Hébert
Hi there, I'm facing with a curious problem. I've an project which is hosted on three differents servers : one (my local PC) : debian lenny / python 2.5.2 / django 1.0.2 final apache 2.2.9 / mod_python 3.3.1-7 the two others (production and validation server) : OpenSUSE 11.1 / python 2.6.2

Re: MySQLdb Exceptions

2009-06-11 Thread Frédéric Hébert
Hi, have you an access to your mysql server config file ? In that case, you could enable logging : To see the current variables values type mysqld --verbose --version in a shell prompt. Search for log* variables. If log is set to false see link below "The general query log is a general record o

How to do custom validation of models ?

2009-06-09 Thread Frédéric Hébert
Hi all, I have two models related with a foreign key like these : CODE --- class Reservation(models.Model): some fields here ... class Periodicite(models.Model): some fields here # rep_opt is a fake suite of bits, where each bit re

Re: Overriding save() method on models to automatically add ManyToMany relationship

2009-06-09 Thread Frédéric Hébert
Hi, > defsave(self, *args): >    models.Model(save, *args) >    category = Category.objects.all()[0] >    self.categories.add(category) > > This does not work, I'm sure it's saving ManyToMany relationships > later on in thesaveprocess.  Is there a way to make this work? > IMHO, it's make sense :