Really what you are proposing is an extension of the scope #19353, and I do 
feel that if the built in forms are to be made more usable with custom 
users, then both the hardcoding of auth.User and the username field should 
be addressed together.

One thing not addressed in your authtools approach that is done in the 
current RegexField of the builtin form is handling regex validation of 
valid usernames - if your custom user requires some other sort of 
validation, you have to hook up some sort of custom validator like you've 
done, which seems like more work than just creating a custom form where you 
can define the fields as you need them. Also you may not need or want all 
REQUIRED_FIELDS in your form - this is a somewhat unfortunate label for 
this property - as it is really more specific to the management command 
prompts (ie, you can specify a field as required in the model, but not 
include it in that list, or vs versa).

A good step here might be a little DDD, write the docs to cover the cases 
where you may need to work around this proposed flexible approach - if it 
seems like it gets too complicated to explain, perhaps just leaving it 
documented as requiring the author to create new forms (which is more work, 
but maybe more straightforward) - may still be the best choice.

If this can be done in a way that maximizes win, I'm all for it, but if it 
is trading less work in some cases, for more in others, I'm less sure.

-Preston


On Monday, June 3, 2013 11:48:40 AM UTC-7, Gavin Wahl wrote:
>
> > The current code assumes that if you write a custom model, you'll also 
> write the corresponding custom forms.
>
> Right. This is what I am proposing be fixed.
>
>
> On Mon, Jun 3, 2013 at 12:31 PM, Aymeric Augustin <
> aymeric....@polytechnique.org <javascript:>> wrote:
>
>> On 3 juin 2013, at 20:01, gavi...@gmail.com <javascript:> wrote:
>>
>> > Some of the built-in auth forms only work on user models whose 
>> `USERNAME_FIELD` is `username`.
>>
>> Hi Gavin,
>>
>> The current code assumes that if you write a custom model, you'll also 
>> write the corresponding custom forms.
>>
>> You may want to have a look at 
>> https://code.djangoproject.com/ticket/19353 which describes the same 
>> problem (as far as I can tell).
>>
>> --
>> Aymeric.
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django developers" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-developers/XxaZ50SxPj4/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> django-develop...@googlegroups.com <javascript:>.
>> To post to this group, send email to 
>> django-d...@googlegroups.com<javascript:>
>> .
>> Visit this group at 
>> http://groups.google.com/group/django-developers?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

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


Reply via email to