Sent from my iPad

> On Sep 19, 2013, at 9:24 PM, Russell Keith-Magee <[email protected]> 
> wrote:
> 
> 
>> On Fri, Sep 20, 2013 at 10:53 AM, <[email protected]> wrote:
>> > Note that EmailUser *doesn't* have a Meta: swappable definition. There is 
>> > nothing on this model that says "I am swappable", or "I am an appropriate 
>> > substitute for User".
>> 
>> Ah, this is were the misunderstanding was. authtools does actually set 
>> swappable on its replacement user, too[1]. The two definitions look like 
>> this:
>> 
>>     class User(Model):
>>         username = models.CharField()
>>         USERNAME_FIELD = 'username'
>>         class Meta:
>>             swappable = 'AUTH_USER_MODEL'
>> 
>>     class EmailUser(Model):
>>         email = models.CharField()
>>         USERNAME_FIELD = 'email'
>>         class Meta:
>>            swappable = 'AUTH_USER_MODEL'
>> 
>> > How does Django identify that EmailUser *shouldn't* be synchronised to the 
>> > database? 
>> 
>> The existing swappable mechanism takes care of it. Only the model referenced 
>> by settings.AUTH_USER_MODEL will be installed, not both. 
> 
> Ah. Thats… interesting. I'm moderately surprised it works at all. I'll need 
> to dig in to the internals to work out *why* it works… swappable certainly 
> wasn't intended to work like that. There might be some interesting land mines 
> lying in wait.

Aha, I think I found at least some of my disconnect. But I tested this 
yesterday, and it definitely does do that.

I know I just asked this in a previous email, but I will repeat for ease of 
others possibly following this thread: can you provide a brief overview of what 
swappable *does* do? It seems to be on observation it does exactly this. You 
say it's intended to do something else. What is that something else?

L

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to