Re: Using custom table instead of "user" in django

2009-08-19 Thread Marek Wawrzyczek

How about writting adapter to the django user class? It can have
descriptor for login (getting login would return users email). While
creating such user login would be set (only once, during creation) for
example the following value: user id converted to string preceded by
one character. For other custom fields there can be also descriptors,
but they would reffer to yours customer model (for example adapters
field homepage which would be descriptor would reffer to
customer.homepage).

Regards,
Marek

On 17 Sie, 19:05, Joshua Partogi  wrote:
> On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist  wrote:
>
> > Here's what I did:
>
> > I took the built in auth system and changed it a bit, or to be more
> > precise I changed all imports within auth (because I moved it within the
> > pythonpath) and edited models.py:
>
> >http://dpaste.com/81651/
>
> > Whole code:
>
> >http://www.ojii.ch/auth.tar.gz
>
> > If you wanna use it:
>
> > Add the folder in the archive to your pythonpath.
>
> > Add 'auth' to your installed applications
>
> > Set 'USER_MODEL' in your settings file to the model you use (string).
>
> Is it better to re-write the user model or to extend it? Any insights?
>
> Thanks in advance
>
> --http://blog.scrum8.comhttp://twitter.com/scrum8
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using custom table instead of "user" in django

2009-08-18 Thread marekw2143

How about writting adapter to the django user class? It can have
descriptor for login (getting login would return users email). While
creating such user login would be set (only once, during creation) for
example the following value: user id converted to string preceded by
one character. For other custom fields there can be also descriptors,
but they would reffer to yours customer model (for example adapters
field homepage which would be descriptor would reffer to
customer.homepage).

Regards,
Marek

On 17 Sie, 19:05, Joshua Partogi  wrote:
> On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist  wrote:
>
> > Here's what I did:
>
> > I took the built in auth system and changed it a bit, or to be more
> > precise I changed all imports within auth (because I moved it within the
> > pythonpath) and edited models.py:
>
> >http://dpaste.com/81651/
>
> > Whole code:
>
> >http://www.ojii.ch/auth.tar.gz
>
> > If you wanna use it:
>
> > Add the folder in the archive to your pythonpath.
>
> > Add 'auth' to your installed applications
>
> > Set 'USER_MODEL' in your settings file to the model you use (string).
>
> Is it better to re-write the user model or to extend it? Any insights?
>
> Thanks in advance
>
> --http://blog.scrum8.comhttp://twitter.com/scrum8
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using custom table instead of "user" in django

2009-08-18 Thread marekw2143

How about writting adapter to the django user class? It can have
descriptor for login (getting login would return users email). While
creating such user login would be set (only once, during creation) for
example the following value: user id converted to string preceded by
one character. For other custom fields there can be also descriptors,
but they would reffer to yours customer model (for example adapters
field homepage which would be descriptor would reffer to
customer.homepage).

Regards,
Marek

On 17 Sie, 19:05, Joshua Partogi  wrote:
> On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist  wrote:
>
> > Here's what I did:
>
> > I took the built in auth system and changed it a bit, or to be more
> > precise I changed all imports within auth (because I moved it within the
> > pythonpath) and edited models.py:
>
> >http://dpaste.com/81651/
>
> > Whole code:
>
> >http://www.ojii.ch/auth.tar.gz
>
> > If you wanna use it:
>
> > Add the folder in the archive to your pythonpath.
>
> > Add 'auth' to your installed applications
>
> > Set 'USER_MODEL' in your settings file to the model you use (string).
>
> Is it better to re-write the user model or to extend it? Any insights?
>
> Thanks in advance
>
> --http://blog.scrum8.comhttp://twitter.com/scrum8
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using custom table instead of "user" in django

2009-08-18 Thread marekw2143

How about writting adapter to the django user class? It can have
descriptor for login (getting login would return users email). While
creating such user login would be set (only once, during creation) for
example the following value: user id converted to string preceded by
one character. For other custom fields there can be also descriptors,
but they would reffer to yours customer model (for example adapters
field homepage which would be descriptor would reffer to
customer.homepage).

Regards,
Marek



On 17 Sie, 19:05, Joshua Partogi  wrote:
> On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist  wrote:
>
> > Here's what I did:
>
> > I took the built in auth system and changed it a bit, or to be more
> > precise I changed all imports within auth (because I moved it within the
> > pythonpath) and edited models.py:
>
> >http://dpaste.com/81651/
>
> > Whole code:
>
> >http://www.ojii.ch/auth.tar.gz
>
> > If you wanna use it:
>
> > Add the folder in the archive to your pythonpath.
>
> > Add 'auth' to your installed applications
>
> > Set 'USER_MODEL' in your settings file to the model you use (string).
>
> Is it better to re-write the user model or to extend it? Any insights?
>
> Thanks in advance
>
> --http://blog.scrum8.comhttp://twitter.com/scrum8
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using custom table instead of "user" in django

2009-08-17 Thread Joshua Partogi
On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist  wrote:

>
> Here's what I did:
>
> I took the built in auth system and changed it a bit, or to be more
> precise I changed all imports within auth (because I moved it within the
> pythonpath) and edited models.py:
>
> http://dpaste.com/81651/
>
> Whole code:
>
> http://www.ojii.ch/auth.tar.gz
>
> If you wanna use it:
>
> Add the folder in the archive to your pythonpath.
>
> Add 'auth' to your installed applications
>
> Set 'USER_MODEL' in your settings file to the model you use (string).


Is it better to re-write the user model or to extend it? Any insights?

Thanks in advance

-- 
http://blog.scrum8.com
http://twitter.com/scrum8

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using custom table instead of "user" in django

2009-08-17 Thread PlanetUnknown

Thanks Jonas.
Quick question - The difference in the models.py is I guess addition
of these two imports -
from django.db.models import get_model
from django.conf import settings

A dumb question, when you say "moved it within the pythonpath", what
exactly does it mean ?



On Aug 17, 8:40 am, Jonas Obrist  wrote:
> Here's what I did:
>
> I took the built in auth system and changed it a bit, or to be more
> precise I changed all imports within auth (because I moved it within the
> pythonpath) and edited models.py:
>
> http://dpaste.com/81651/
>
> Whole code:
>
> http://www.ojii.ch/auth.tar.gz
>
> If you wanna use it:
>
> Add the folder in the archive to your pythonpath.
>
> Add 'auth' to your installed applications
>
> Set 'USER_MODEL' in your settings file to the model you use (string).
>
> Done.
>
> NOTE: I did NOT test this yet!
>
> Jonas
>
> PlanetUnknown wrote:
> > Guys,
> >         I have a quick question. I am attracted to django due to its
> > flexibility however there is something bothering me now.
> > My question is can I use a custom table, say "consumer" instead of the
> > one provided my django ?
> > Here are the reasons -
> > 1.) I have my whole DB model around this consumer table and want to
> > keep it.
> > 2.) This table has a lot more fields than what the user has, which are
> > custom and uses the "email address" as the username.
>
> > I know no. 2 has a solution of using a custom backend, but there are
> > so many out there that they confuse me. Also,I don't want to use the
> > "admin" part of django since I'll have a custom app. for that, but
> > which works on "consumer"
>
> > I'm worried if I there is no way around using the django provided
> > "user" I'll have to re-invent the wheel, is that true ? e.g. session
> > management, etc. Not afraid of coding, but the whole reason I chose
> > django was to not do this.
>
> > Any direction by the Gurus is appreciated.
> > Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using custom table instead of "user" in django

2009-08-17 Thread Jonas Obrist

Here's what I did:

I took the built in auth system and changed it a bit, or to be more 
precise I changed all imports within auth (because I moved it within the 
pythonpath) and edited models.py:

http://dpaste.com/81651/

Whole code:

http://www.ojii.ch/auth.tar.gz

If you wanna use it:

Add the folder in the archive to your pythonpath.

Add 'auth' to your installed applications

Set 'USER_MODEL' in your settings file to the model you use (string).

Done.

NOTE: I did NOT test this yet!

Jonas

PlanetUnknown wrote:
> Guys,
> I have a quick question. I am attracted to django due to its
> flexibility however there is something bothering me now.
> My question is can I use a custom table, say "consumer" instead of the
> one provided my django ?
> Here are the reasons -
> 1.) I have my whole DB model around this consumer table and want to
> keep it.
> 2.) This table has a lot more fields than what the user has, which are
> custom and uses the "email address" as the username.
>
> I know no. 2 has a solution of using a custom backend, but there are
> so many out there that they confuse me. Also,I don't want to use the
> "admin" part of django since I'll have a custom app. for that, but
> which works on "consumer"
>
> I'm worried if I there is no way around using the django provided
> "user" I'll have to re-invent the wheel, is that true ? e.g. session
> management, etc. Not afraid of coding, but the whole reason I chose
> django was to not do this.
>
> Any direction by the Gurus is appreciated.
> Thanks.
>
> >
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---