Re: contrib.auth and User model

2007-11-09 Thread Gary Wilson
Alexander Solovyov wrote: > But lets' listen what core developers think about making this the > official way. :) Personally, I like the idea of being able to switch out User models, as long as a base interface can be worked out. It seems that there might be a few people using a version of a patc

Re: auth messages should be lazy

2007-11-09 Thread Gary Wilson
SmileyChris wrote: > It seems silly that currently the auth message system calls > get_and_delete_messages for every request context (assuming you have > the auth context processor enabled, like it is by default). > > 1. You lose messages if you don't actually check for them > > 2. If you didn't

Re: Debugging Django

2007-11-09 Thread guettli . google
On Fri, Nov 09, 2007 at 08:32:15AM -0700, John M. Anderson wrote: > > You cannot debug a single Django file in isolation. Instead, insert this > > line: > > > >import pdb; pdb.set_trace() > > > > in sql.py, at the point you're interested in. Then run Django normally, > > and > > go to a db-bas

Re: ModelForms

2007-11-09 Thread Joseph Kocherhans
On 11/9/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > > On Nov 9, 2007 12:42 PM, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > > Why not just do this? No need for any special new fields at all. > > > > class Article(models.Model): > > author = models.ForeignKey(User) > > title

Re: ModelForms

2007-11-09 Thread Marty Alchin
On Nov 9, 2007 12:42 PM, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > Why not just do this? No need for any special new fields at all. > > class Article(models.Model): > author = models.ForeignKey(User) > title = models.CharField(max_length=255) > body = models.TextFi

Re: ModelForms

2007-11-09 Thread Joseph Kocherhans
On 11/9/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > > On Nov 9, 2007 9:57 AM, Marty Alchin <[EMAIL PROTECTED]> wrote: > > The only thing it doesn't handle yet is how to remove > > fields from the customized form, but this might be as simple as > > assigning the field to None or some new Excluded

Re: ModelForms

2007-11-09 Thread Joseph Kocherhans
On 11/9/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > If we're kicking around ideas on this, here's a slightly different > suggestion. First, an example: > > class MyForm(Form): > extra_field = forms.CharField() > > class Meta: > model = MyModel > fields = ('a','b'

Re: ModelForms

2007-11-09 Thread EL AATIFI Sidi Mohamed
I'm agree with you, but this example is just for demonstration purposes, but concerning the proposition, we really need something to reuse our model definitions into forms without rewrite(DRY), since that a form field, in many cases, has the same validation rules in both, back end and front end.

Re: ModelForms

2007-11-09 Thread Marty Alchin
On Nov 9, 2007 10:07 AM, Smel <[EMAIL PROTECTED]> wrote: > PS : > http://smelaatifi.blogspot.com/2007/08/declarative-forms-django-newforms.html I'd say I'm -1 on including admin-style field declarations to forms. I'm of the mind that, if you need that level of design on a custom form, just write

Re: Debugging Django

2007-11-09 Thread John M. Anderson
> You cannot debug a single Django file in isolation. Instead, insert this > line: > >import pdb; pdb.set_trace() > > in sql.py, at the point you're interested in. Then run Django normally, > and > go to a db-based URL: you'll get a debugger prompt. > ok, thanks. I was just trying to debug wit

Re: ModelForms

2007-11-09 Thread Marty Alchin
On Nov 9, 2007 9:57 AM, Marty Alchin <[EMAIL PROTECTED]> wrote: > The only thing it doesn't handle yet is how to remove > fields from the customized form, but this might be as simple as > assigning the field to None or some new ExcludedField class or > something. I actually like the idea of an Ex

Re: ModelForms

2007-11-09 Thread Smel
+1, I agree, since I no longer use form_for_X method for a while I use something like that: from forms import SimpleForm from django.contrib.auth.models import User import django.newforms as forms class UserForm(SimpleForm): model = User password2 = forms.CharField(label='Confirm passw

Re: ModelForms

2007-11-09 Thread Marty Alchin
Fair warning: I haven't been following this very closely, so I'm probably way out in left field here. Feel free to look strangely at me after I mention this. Would it be possible to use a factory pattern for ModelForm? class Article(models.Model): title = models.CharField(max_length=255)

Re: ModelForms

2007-11-09 Thread Jacob Kaplan-Moss
Hi folks -- Just to make sure everyone's on the same page: Joseph and I have talked about this in person quite a bit, and I'm a strong +1 (if that's possible). I don't feel strongly about the particulars -- Russell's proposal is interesting, but I haven't thought it through fully -- but I fully

Re: ModelForms

2007-11-09 Thread Russell Keith-Magee
On Nov 8, 2007 1:26 PM, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > > form_for_model and form_for_instance seem like complicated and clever > ways to accomplish what basically boils down to a form that has a save > method and can accept a model instance in its constructor method. > ModelForm wo

Re: caching problems in the documentation pages

2007-11-09 Thread Manlio Perillo
Malcolm Tredinnick ha scritto: > On Thu, 2007-11-08 at 22:08 +0100, Manlio Perillo wrote: >> Hi. >> >> I have noted that Firefox does not caches well the pages of Django >> documentation: >> >> GET /documentation/cache/ HTTP/1.1 >> Host: www.djangoproject.com >> User-Agent: Mozilla/5.0 (X11; U; L

Re: Debugging Django

2007-11-09 Thread Nicola Larosa
John M. Anderson wrote: > I'm trying to debug sql.py > > the steps I've taken so far: > > python /usr/lib/python2.5/pdb.py manage.py sql polls > (python manage.py polls works just fine) You cannot debug a single Django file in isolation. Instead, insert this line: import pdb; pdb.set_trace

Debugging Django

2007-11-09 Thread John M. Anderson
I'm trying to debug sql.py the steps I've taken so far: python /usr/lib/python2.5/pdb.py manage.py sql polls (python manage.py polls works just fine) (Pdb) b django/core/management/sql.py:271 (Pdb) c Traceback (most recent call last): File "/usr/lib/python2.5/pdb.py", line 1213, in main p