I think adding *"user" *in the fields array of the *ProfileSerializer*'s
Meta class should solve the issue.
On Thursday, July 30, 2020 at 5:22:06 PM UTC+6 tosina...@gmail.com wrote:
> i have it defined in another app, but i've gotten it attached below
>
> On Thu, Jul 30, 2020 at 11:50 AM 'Amit
i have it defined in another app, but i've gotten it attached below
On Thu, Jul 30, 2020 at 11:50 AM 'Amitesh Sahay' via Django users <
django-users@googlegroups.com> wrote:
> Where is your "CustomUser" defined? D you think it could be
>
> user = models.OneToOneField(User, ..)
>
> Regards,
> Amit
Where is your "CustomUser" defined? D you think it could be
user = models.OneToOneField(User, ..)
Regards,
Amitesh
On Thursday, 30 July, 2020, 03:59:59 pm IST, ola neat
wrote:
good day fellaz, i'm working on extending my user model to enable user create
a profile but i'm getting a
Hello,
did you run manage.py migrate?
When you add a ForeignKey or OneToOne to a model, what actually gets stored
in the DB is the ID of the referenced object (in this case, a
auth.models.User). So the user_id column should be created for you during
the next makemigrations+migrate combo.
On a si
I have a Users table inside of a postgresql database in which auth_user
also lives. I want the Users objects to have a OneToOne to the auth_user
model. I added a line to my models.py under my Users class:
user = models.OneToOneField(User, unique=True)
There are probably other things wrong, beca
Hmm...I see. How do you choose what variables are available to which
view? It seems like anything I put in context_processors is available
anywhere, and I'm not sure I want that.
I think I am getting closer, but I am now getting a
SiteProfileNotAvailable error.
Here is my stack trace:
http://dpa
You could use a context processor, which is basically a function that adds
variables to *every* template that gets called from a properly setup view. I
assume the view you are using does apply context processors, and defining
one is as easy as:
http://stackoverflow.com/questions/3722174/django-tem
Sorry, I meant I was hoping to avoid diving into defining my own views
until later.
On Jul 11, 1:08 pm, Brent wrote:
> So I need to create a custom view? (I can't use an existing view)? I
> was hoping to avoid diving into templates until later, after I've
> become a little more familiar with the
So I need to create a custom view? (I can't use an existing view)? I
was hoping to avoid diving into templates until later, after I've
become a little more familiar with the python/html code.
On Jul 11, 11:48 am, Andre Terra wrote:
> This is done in your view:
>
> https://docs.djangoproject.com/e
This is done in your view:
https://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext
Cheers
On Mon, Jul 11, 2011 at 3:12 PM, Brent wrote:
> Is this done in urls.py?
>
> On Jul 11, 10:55 am, Andre Terra wrote:
> > Pass user.get_profile() as a template variabl
Is this done in urls.py?
On Jul 11, 10:55 am, Andre Terra wrote:
> Pass user.get_profile() as a template variable instead by adding it to the
> template context.
>
> Cheers,
> André
>
>
>
>
>
>
>
> On Mon, Jul 11, 2011 at 2:50 PM, Brent wrote:
> > Okay, thanks. This is really helpful.
>
> > I am
Okay, thanks. This is really helpful.
I am having trouble calling get_profile() from within my profile.html
template, though. Here is my stack trace:
http://dpaste.com/566583/
I tried calling get_profile without the (), which got rid of the
error, but no data showed up.
On Jul 11, 10:15 am, And
Pass user.get_profile() as a template variable instead by adding it to the
template context.
Cheers,
André
On Mon, Jul 11, 2011 at 2:50 PM, Brent wrote:
> Okay, thanks. This is really helpful.
>
> I am having trouble calling get_profile() from within my profile.html
> template, though. Here is
All you have to do is add the following code to your models.py (or any other
module that gets loaded by django, for that matter):
# models.py
from django.db.models import signals
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user
I am having trouble with this line of the tutorial: "You need to
register a handler for the signal django.db.models.signals.post_save
on the User model, and, in the handler, if created=True, create the
associated user profile."
It seems I need to edit the User model. I am confused, though, because
Wherever you would reference a user instance, reference UserProfile.user
instead
If you need to find out a profile from request.user, you can use
request.user.get_profile() or the longer UserProfile.objects.get(user_id=
request.user.id)
Cheers,
André
On Mon, Jul 11, 2011 at 1:48 PM, Brent wrot
Dnia 2011-07-11, pon o godzinie 09:48 -0700, Brent pisze:
> How do I use a foreign key, though? In other words, how do I tell my
> code to look at UserProfile rather than just user?
https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
--
Michał (Saviq) S
Thanks for the responses.
How do I use a foreign key, though? In other words, how do I tell my
code to look at UserProfile rather than just user?
On Jul 10, 5:08 am, Jonas Geiregat wrote:
> Op 10-jul-2011, om 12:37 heeft Venkatraman S het volgende geschreven:
>
>
>
> > This is not good design. I
Op 10-jul-2011, om 12:37 heeft Venkatraman S het volgende geschreven:
>
> This is not good design. If you want to store some extra fields for a User -
> i would define just another model called ProfileDetails, FK it to User and
> use it as such.
That's also how I would do it, some example cod
On Sun, Jul 10, 2011 at 1:05 PM, Brent wrote:
> Hi all,
>
> I am attempting to follow this tutorial:
>
> http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
>
> But I am receiving this error:
> AttributeError at /login/
> 'NoneType' object has no attribute 'D
Hi all,
I am attempting to follow this tutorial:
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
But I am receiving this error:
AttributeError at /login/
'NoneType' object has no attribute 'DoesNotExist'
Here is my stack trace:
http://dpaste.com/565795/
takn again
On 3 Set, 18:40, Shawn Milochik wrote:
> Yes, the password stored will only ever be the hash type, hash salt,
> and hash. You should never store it in plain text.
>
> If you're interested you can look at the actual model. You might be
> interested in these functions: set_password(), ge
Yes, the password stored will only ever be the hash type, hash salt,
and hash. You should never store it in plain text.
If you're interested you can look at the actual model. You might be
interested in these functions: set_password(), get_hexdigest(), and
check_password().
These make it clear what
a, ok tank you. Your post clarify me much woolly things in my
mind.
So I understand that password field will not be treated in standard
manner, and it needs to be managed very carefully. Its purpose is only
to store the final encrypted password, isn't it?
On 3 Set, 17:14, Shawn Milochik wrote
You should exclude the password field in your overridden model form.
If you want to have a password added at the time of user registration
then you can add an additional charfield to the form (make sure to use
the "password" widget). You should probably add two such fields so you
can compare them t
here they are:
import string
# Django settings for djapps project.
#...
modifica ng
ROOT_URLCONF = 'djapps.urls'
import os
PROJECT_DIR = os.path.dirname(globals()["__file__"])
#...
On 03/set/2010, at 12:54, djnubbio wrote:
> How can I handle it? which function have i to attach to that url?
Could you tell us your urls and settings, and in particular the
INSTALLED_APPS variable?
--
You received this message because you are subscribed to the Google Groups
"Django user
Hi all, i'm new to django...sorry for wasting your preciouse time
my question:
i'm extending User model; all seems ok and working; however when
adding a new user in the form derived from ModelForm a field password
is displayed like the following:
password: ___ Usa
Carl, scratch my last message. It does work. Woot! Thanks very
much.
On Mar 26, 2:39 pm, Jim N wrote:
> On Mar 26, 1:39 pm, Carl Zmola wrote:
>
>
>
>
>
> > On 03/25/2010 02:37 PM, Jim N wrote:
> > > Very interesting, Tom.
>
> > > I have inserted this code, substituting my profile model name
>
On Mar 26, 1:39 pm, Carl Zmola wrote:
> On 03/25/2010 02:37 PM, Jim N wrote:
> > Very interesting, Tom.
>
> > I have inserted this code, substituting my profile model name
> > (QotdUser) for UserProfile. It does create a row in QotdUser, but the
> > row is empty of course.
>
> > More importantly,
On 03/25/2010 02:37 PM, Jim N wrote:
Very interesting, Tom.
I have inserted this code, substituting my profile model name
(QotdUser) for UserProfile. It does create a row in QotdUser, but the
row is empty of course.
More importantly, if I create a user via the admin interface (http://
127.0
Hi Peter,
I'm building an app where all logged-in users will be a Django user,
rather than creating some new separate class of users just for my own
app.
But to make it work, these users have to have more than the minimal
information contained in the django.contrib.auth.models User. I
figure tha
Generally, try to build your application so that it doesn't blindly
depend on the profile existing. The signal example Tom showed you is
good as it means you won't have to check if the UserProfile instance
exists for the user on every turn. However, don't depend on the data
within. Keep it light an
On Mar 11, 1:03 pm, Tom Evans wrote:
> On Thu, Mar 11, 2010 at 4:54 PM, russianbandit
> wrote:
> > I'm using UserProfile to add one field to my users. However, I know
> > that I must explicitly create UserProfile for each new user that
> > registers. So, I make a UserProfile upon registration. I
On Thu, Mar 11, 2010 at 4:54 PM, russianbandit wrote:
> I'm using UserProfile to add one field to my users. However, I know
> that I must explicitly create UserProfile for each new user that
> registers. So, I make a UserProfile upon registration. Is UserProfile
> still the best way to extend the
I'm using UserProfile to add one field to my users. However, I know
that I must explicitly create UserProfile for each new user that
registers. So, I make a UserProfile upon registration. Is UserProfile
still the best way to extend the user model?
What about the admin user, or users that the admin
On Jun 9, 3:11 am, ariest wrote:
> Im developing a childcare app and I have a problem when I want to
> relate an object of a table with a UserProfile field so for example:
>
> user:some_parent
>
> In a view, I want to see only the childs of that parent.
>
> In python manage.py shell:
>
> -Example
Im developing a childcare app and I have a problem when I want to
relate an object of a table with a UserProfile field so for example:
user:some_parent
In a view, I want to see only the childs of that parent.
In python manage.py shell:
-Example: Parent case-
user.userprofile_set.create(tipo=
On Tue, 2009-01-27 at 21:44 +0100, Alex Rades wrote:
[...]
> my situation is: It's a site for students and companies, where
> students can post their data and search for internships, and companies
> post their data, internship opportunities, and search for students.
>
> So, students have to fill
On Tue, Jan 27, 2009 at 5:12 AM, Malcolm Tredinnick
wrote:
>
> On Tue, 2009-01-27 at 00:11 +0100, Alex Rades wrote:
>> Hi,
>> I need to have two sets of users in my application: One is the Person
>> and the other is the Company. So, I have to decide between going with
>> the userprofile way or in
gt;
> I found a snippet how to extend django User model:
> http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
>
> But when added the proposed code to my view:
> (so now it looks like this)
> from django.contrib.auth.models import User
>
>
>
Hi!
I want to add a profile to every user, that I can register in my
application. In future it should contain such fields as avatar, email,
about_me fields
I found a snippet how to extend django User model:
http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
But when added
On Tue, 2009-01-27 at 00:11 +0100, Alex Rades wrote:
> Hi,
> I need to have two sets of users in my application: One is the Person
> and the other is the Company. So, I have to decide between going with
> the userprofile way or inheriting from User.
>
> The problem with userprofile is that i can
Hi,
I need to have two sets of users in my application: One is the Person
and the other is the Company. So, I have to decide between going with
the userprofile way or inheriting from User.
The problem with userprofile is that i can only register One class
with AUTH_PROFILE_MODULE
The problem with
Nevermind - was overcomplicating things as always.
On Nov 12, 1:30 pm, joshuajenkins <[EMAIL PROTECTED]> wrote:
> I'm not sure how I would call it from within the template.
>
> Ideally I'd like to call it from the view so I can manipulate that
> data before passing it to the template.
>
> Basical
I'm not sure how I would call it from within the template.
Ideally I'd like to call it from the view so I can manipulate that
data before passing it to the template.
Basically what I'm trying to do is split my Users up by a field in the
profile and pass each of those lists individually to the te
On 12 nov, 22:05, joshuajenkins <[EMAIL PROTECTED]> wrote:
> So I'm doing basically what Chapter 12 references in the djangobook on
> how to add a profile to Users.
>
> All is well in terms of adding users and pulling out the profile with
> get_profile() on single users, but when I'm trying to p
So I'm doing basically what Chapter 12 references in the djangobook on
how to add a profile to Users.
All is well in terms of adding users and pulling out the profile with
get_profile() on single users, but when I'm trying to pull out all
Users in my view and append the profile data, I'm lost.
B
Step 1: Write something like this in the appropriate app's models.py
class CustomUser(User):
client=models.ForeignKey('Client')
Step 2: Either create your own ModelAdmin that extends
django.contrib.auth.admin.UserAdmin or just use UserAdmin outright.
Step 3: Create a middleware that runs a
profile is in another table, so this approach is not enough.
I have tried the idea in
http://www.amitu.com/blog/2007/july/django-extending-user-model/,
but i keep getting this error:
'MyUserAdmin.fieldsets[4][1]['fields']' refers to field 'client' that
is missin
On Fri, Jun 13, 2008 at 10:54 PM, meppum <[EMAIL PROTECTED]> wrote:
> With the query refactoring branch being merged to the trunk I wanted
> to finally move some of the data I had put on my user profiles to a
> derrived user model. I didn't see this mentioned in the documentation
> and I wanted to
Alessandro Ronchi ha scritto:
>
>
> On 2 Giu, 00:33, puff <[EMAIL PROTECTED]> wrote:
>
>> I'm stumped. What am I missing?
The edit_inline doesn't work.
Anyone managed to make it?
--
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net - Il mio blog
http://www.soasi.com - Svil
On 2 Giu, 00:33, puff <[EMAIL PROTECTED]> wrote:
> I'm stumped. What am I missing?
>
> Thanks for any help.
I've the same problem.
If I manage to have the profile saved and I then edit the User, it
reset the profile one time every two.
Please help us!
--~--~-~--~~~--
I'm relatively new to Django and struggleing a bit trying to extend
Django's native User model.
What I'd like to achieve is the following:
- Add a few fields to the existing User model
- Have these fields editable on Django's Admin screen
- When a new User is saved, execute a bit of code to tell
On 7/26/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 7/25/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote:
> > I realized a new way to extend user models, it is simpler than official
> > get_profile approach of django[1] as there is only one model to work
> with,
> > and relationships are kept o
On 7/25/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote:
> I realized a new way to extend user models, it is simpler than official
> get_profile approach of django[1] as there is only one model to work with,
> and relationships are kept on the right model, and gives a less hacky feel
> than "replaces_
public_comments = property(_get_comments)
*del* _get_comments
User.__bases__ = User.__bases__ + ( UserExtension, )
Read my blog post about the same[3] for a longer discussion about pros and
cons. How does it sound?
1. http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model
2. http://cod
One more thing: If I do what it says, and send it the user in the form
of a class, it will continue, but after running "newprofile.save()",
nothing is written to the db table.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
I'm using the 'one to one' method of creating a user profile which
extends django's built-in user model. This is a workaround suggested by
James Bennett on his b-list blog, and I think several other people are
using this or something similar.
My problem is that I have a database I am importing. I
Sorry. Can't believe I forgot to mention that part!
The error was that theid could not be found in the database. Which made
no sense to me since I was trying to create a new user.
I was able to do this, however, after much experimentation:
new_user = user_profile.objects.create(user_id=the_user
On 12/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> new_profile = user_profile(user=some_user)
>
> but it gives me an error.
What error? Without seeing the exact error message, it's hard to debug ;)
--
"May the forces of evil become confused on the way to your house."
-- George Carlin
I am having this exact issue. How does one instantiate a userprofile
object?
I've tried something like
new_profile = user_profile(user=some_user)
but it gives me an error.
I'm really not sure what to do, I follow the guide linked above but now
I'm stuck.
Thanks in advance.
-Dougal
On Dec 2,
> 1. You have to explicitly instantiate and save a UserProfile object
> before get_profile() will do anything -- Django will not implicitly
> create objects for you in the shell like that.
>
This is what I need to know. Thanks James.
--~--~-~--~~~---~--~~
You
On 12/1/06, scum <[EMAIL PROTECTED]> wrote:
> >>> a = User()
> >>> a.save()
> >>> a.get_profile()
> Traceback (most recent call last):
> ...
> DoesNotExist: UserProfile matching query does not exist.
Well, two things are going wrong here.
1. You have to explicitly instantiate and save a UserProf
t; Traceback (most recent call last):
> ...
> DoesNotExist: UserProfile matching query does not exist.
>
> The Question:
> How do I get the userprofile created with each user? (I tried the
> OneToOne model and that didn't work either).
>
>
Trying to extend the user group using this model code:
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True,
edit_inline=models.TABULAR, num_in_admin=1,min_num_in_admin=1,
max_num_in_admin=1,num_extra_on_change=0)
hours = models.FloatField( max_digits=8, dec
On 8/25/06, Jakub Labath <[EMAIL PROTECTED]> wrote:
> Internal dispatcher sounds good :-). Only thing that worries my is the
> word internal. Is this something that is likely to stay or will this
> be gone when the next version comes along. The decision I'll make will
> likely have long lasting im
Hi All,
On 8/25/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> Check out Django's internal dispatcher; whenever an instance of a
> model is saved, the dispatcher signals 'pre_save' and 'post_save' are
> fired before and after the save, respectively, with information about
> the class of model w
On 8/24/06, Jakub Labath <[EMAIL PROTECTED]> wrote:
> I think I'm with the 20% just the extra fields is not enough in my case.
> I will need the ability to call my functions before and/or after the
> User object is saved in django user admin. For example
> somebody changes user's email in admin I
I hate how hackish it is, actually. Unfortunately for me, I need it to work, and work now, so ...On 8/24/06, Jakub Labath <
[EMAIL PROTECTED]> wrote:I guess the Foreign Key solution suggested by Joe would actually work
here. Since the inline objects are getting saved with parents and Ican just ove
Wow you're even in worse shape than I am. :)
I Foreign Keyed my user profiles ( it's very hackish, PHP 3 hackish )
and had expected to need to write my own app to manage them whether I
could subclass User or not. Asking the Admin Tool to acknowledge an
extended user object is really being unreason
Hi,
> On 8/9/06, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> > I very much want to subclass User as I have more than one kind of user
> > and each has a different type of profile.
>
> Which is a different situation from probably 80% of the needs people
> have for extending the User model.
I thin
On 8/9/06, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> I very much want to subclass User as I have more than one kind of user
> and each has a different type of profile.
Which is a different situation from probably 80% of the needs people
have for extending the User model.
> Until we get proper
On 8/9/06, Chris Kelly <[EMAIL PROTECTED]> wrote:
> If I am understanding correctly now, does this mean I have to manage the
> creation of the user profile object (and also any other classes tied to a
> user) when I create the user?
Yes; OneToOne requires that an object exist on both ends of the
and will
> not provide any easier/better/more efficient way to extend the User
> model (as I noted in my blog entry about extending User). The fact
> that AUTH_PROFILE_MODULE and get_profile() were around when
> subclassing worked in the 0.90 and 0.91 releases should indicate that
> f
Rockin. thanks for the heads up. it does look like the profile approach is the way to go. I first thought of subclassing as an approach coming from a C++ish background, where one can drop a subclass in place of a parent class to replace/ add functionality. It appears that the user class is a little
On 8/9/06, Chris Kelly <[EMAIL PROTECTED]> wrote:
> and it appears that using a one-to-one mapping (the
> article's preferred method) is discouraged.
I'm launching a campaign to have that line purged from the official
documentation, with extreme prejudice. OneToOneField isn't going away
and, AFAI
t.com/wiki/ModelInheritance
That being the case, *currently* the best way to extend the User model
is to follow the suggestions outlined by James[2] which you have
already seen.
[2] http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model
--
Waylan Limberg
[EMAIL PROT
t was ugly
and went away a long time ago and, God willing, will never come back.
So despite popular misconception, model inheritance does not and will
not provide any easier/better/more efficient way to extend the User
model (as I noted in my blog entry about extending User). The fact
that AUTH_PROF
Use a user profile. Define a model similar to the following:
[code]
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
#add extra fields you want here
user =models.ForeignKey(User
,unique=True,edit_inline=models.S
/06/06/django-tips-extending-user-model
Alas, there seems to be some issues with those approaches, one being
that according to the article, "model subclassing is being refactored
in trunk right now" and it appears that using a one-to-one mapping (the
article's preferred method) is d
Hi All
I'm having a problem with extending User to include a couple of
additional fields, and allowing them to be edited in the Admin module.
I've followed the debate on
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model,
and have the following model:
class U
Luke Plant <[EMAIL PROTECTED]> writes:
> This is actually quite interesting. You would need to alter your
> patch a bit so that it works for models with 'app_label' defined --
> the "model_module.__name__.split('.')[-2]" logic should exist in
> only one place.
Good point. Another problem I ran
On Friday 09 June 2006 18:02, Marcin Kaszynski wrote:
> I just spent some time looking for a way to extend the User model in
> a way that would allow me to:
>
> 1. add fields to the model itself,
> 2. use the standard admin interface to edit them,
> 3. keep changes to Django minimal and generic.
Hi,
I just spent some time looking for a way to extend the User model in a
way that would allow me to:
1. add fields to the model itself,
2. use the standard admin interface to edit them,
3. keep changes to Django minimal and generic.
I came up with something that actually works well and is gen
Hi folks.
I realize this is a recurring question on this list but I have not
found an authoritative answer, maybe some one can show me the best path
to take.
I want to add new fields to a User class.
should I:
1) extend from auth.User as described in the wiki. This seems nice, but
I feel like
I've done this with the latter approach. I made a person model that
had more person-specific information and made the user field a foreign
key and added the edit_inline option to have the information right
there in the user interface:
user = meta.ForeignKey(auth.User, edit_inline=meta.STACKED,
n
That did it. Thanks.
char wrote:
I've seen a couple of approaches on this mailing list for adding
application specific fields to the User class. The first involves
extending auth.User but this seems a little complex, and was
specifically labeled an "advanced" method. It doesn't seem like you
should have to break out
I've seen a couple of approaches on this mailing list for adding
application specific fields to the User class. The first involves
extending auth.User but this seems a little complex, and was
specifically labeled an "advanced" method. It doesn't seem like you
should have to break out deep black ma
90 matches
Mail list logo