Using Django 1.10 Admin with a legacy contrib.auth.user plus 1:1 userprofile
It works fine but I'm having trouble letting the user adjust their name
and email address in contrib.auth.user.
Additionally, I reveal some of the user profile fields as an Admin
inline under the Company mode
Here is the problem line in your view:
return redirect('success:profile_accounts')
You'll need to create an appropriate URL entry for your form submission
redirect.
-James
On Jun 10, 2017 9:23 AM, "change i need" wrote:
> Here is my model.py
>
>
> # U
Here is my model.py
# User profile model
class UserProfile(models.Model):
user = models.OneToOneField(User,unique=True,on_delete=models.CASCADE)
bio = models.TextField(max_length=500,null=True,blank=True)
picture = models.ImageField(upload_to="profile_image",null=True,blank=True
r/register/$',
RegistrationView.as_view(form_class = UserProfileForm),
name = 'registration_register'),
url(r'^user/', include('registration.backends.default.urls')),
]
I have a UserProfile model as given below. (userprofile/models.py)
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
:17:03 UTC+2 schreef Marco Neumann:
>
> Hi all,
>
>
> I would like to make a registration form with the User SignUp form and
> extra UserProfile fields.
>
> So after saving the user is created and the data is saved in the
> UserProfile model.
>
> Can someone point m
Hi all,
I would like to make a registration form with the User SignUp form and
extra UserProfile fields.
So after saving the user is created and the data is saved in the
UserProfile model.
Can someone point me in the right direction.
Thanks in advacend.
Greetings
Marco neumann
--
You
>
> But after that I don't understand how I can use the information in the
> user table (like the pages that the user is allowed to enter) in django
> and how to set it somewhere. And also since I should change the menu to
> reflect that the user can go or not to one page how can I send this in
Hello,
I'd like to emphasize that it is probably a newbie question but I
don't know what are the keyword I should use for googling. So any
information would be helpful.
I'm trying to add a userprofile to my django app. The idea is to use
a sign-in system so that the us
Set MEDIA_URL to '/media/' or something.
Then add static() to your urls.py if you haven't.
https://docs.djangoproject.com/en/dev/howto/static-files/#serving-files-uploaded-by-a-user-during-development
--
You received this message because you are subscribed to the Google Groups
"Django users" g
t;Likes cheese: Favourite hamster name: Avatar:
Currently: http://127.0.0.1:8000/accounts/profile/1406912993_56_tumblr_m5xo9h5X3E1qgfdhto1_500.gif>">1406912993_56_tumblr_m5xo9h5X3E1qgfdhto1_500.gif
ClearChange: http://127.0.0.1:8000/static/userprofile/uploaded_files/>&quo
This looks wrong to me:
>
>
>
so maybe, rearranging your code a bit:
{% if form.avatar %}
{% endif %}
{{ form.avatar }}
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving e
s_%s" % (str(time()).replace('.','_'), filename)
#_______
class UserProfile(models.Model):
user = models.OneToOneField(User)
nickname = models.CharField(max_length=50)
likes_cheese = models.BooleanField(default=False)
Thank you !
I was should be set up unique=True
2014年5月12日月曜日 18時46分22秒 UTC+9 Erik Cederstrand:
>
> Den 12/05/2014 kl. 11.38 skrev hito koto >:
>
>
> > Ok, Thank you!
> >
> > So, this is my the full codes;
>
> Are you sure your database is in sync with your model? The error message
> implies
Reset your database and test again.
2014-05-12 10:46 GMT+01:00 Erik Cederstrand :
> Den 12/05/2014 kl. 11.38 skrev hito koto :
>
> > Ok, Thank you!
> >
> > So, this is my the full codes;
>
> Are you sure your database is in sync with your model? The error message
> implies that the field is defi
Den 12/05/2014 kl. 11.38 skrev hito koto :
> Ok, Thank you!
>
> So, this is my the full codes;
Are you sure your database is in sync with your model? The error message
implies that the field is defined with unique=True, but your model doesn't
define it so:
start_work = models.ForeignKey(Sta
This the error is came out when edited and saved
2014年5月12日月曜日 18時21分45秒 UTC+9 Erik Cederstrand:
>
> Den 12/05/2014 kl. 10.53 skrev hito koto >:
>
>
> > Hi,
> >
> > i have this error , why ?
> >
> >
> > (1062, "Duplicate entry '1' for key 'start_work_id'")
> > Exception Type:Integ
Ok, Thank you!
So, this is my the full codes;
class Staff(models.Model):
user = models.OneToOneField(User)
user_name = models.CharField(max_length=255,)
first_kana = models.CharField(max_length=255,)
last_kana = models.CharField(max_length=255, )
employee_number = models.Cha
Den 12/05/2014 kl. 10.53 skrev hito koto :
> Hi,
>
> i have this error , why ?
>
>
> (1062, "Duplicate entry '1' for key 'start_work_id'")
> Exception Type: IntegrityError
> Exception Value:
> (1062, "Duplicate entry '1' for key 'start_work_id'"
Please post your code for the model
Hi,
i have this error , why ?
(1062, "Duplicate entry '1' for key 'start_work_id'")
Exception Type: IntegrityError Exception Value:
(1062, "Duplicate entry '1' for key 'start_work_id'"
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
On Saturday, 9 March 2013 04:56:52 UTC+11, frocco wrote:
>
> Hello,
>
> right now, if I create a user in admin, I have to also create their
> userprofile that I have defined in settings.
>
> Is there a way to automate this?
>
> Thanks
>
>
>
Hi,
If by automat
Yes. Use a post-save signal.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to djan
Hello,
right now, if I create a user in admin, I have to also create their
userprofile that I have defined in settings.
Is there a way to automate this?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from
t; 2) post_save on User is triggered, and User's profile is created
> 3) Django admin saves the UserProfile... but it already exists, and an
> integrity error is raised
>
>
> I'm currently looking into a solution to this as well, and will let
> you know what I fin
t;> all partners, how do I have to set is_admin differently for every partner?
>>
>> class UserProfile(models.Model):
>> partners = models.ManyToManyField('partners.Partner', null = True,
>> blank = True)
>> user = models.OneToOneField(User
ne one or more admin
>> user for every partner.
>>
>> This is my accounts/models.py. In this case is_admin is set globally for
>> all partners, how do I have to set is_admin differently for every partner?
>>
>> class UserProfile(models.Model):
>> par
unts/models.py. In this case is_admin is set globally for
> all partners, how do I have to set is_admin differently for every partner?
>
> class UserProfile(models.Model):
> partners = models.ManyToManyField('partners.Partner', null = True,
> blank = True)
>
case is_admin is set globally for
> all partners, how do I have to set is_admin differently for every partner?
>
> class UserProfile(models.Model):
> partners = models.ManyToManyField('partners.Partner', null = True,
> blank = True)
> user = models.OneToOneField(Us
admin differently for every partner?
class UserProfile(models.Model):
partners = models.ManyToManyField('partners.Partner', null = True,
blank = True)
user = models.OneToOneField(User)
is_admin = models.BooleanField(default = False)
def __unicode__(self):
retur
On 5-7-2012 19:06, DF wrote:
> django.db.utils.DatabaseError: relation "report_userprofile" does not exist
> LINE 1: INSERT INTO "report_userprofile" ("user_id", "first_name", "...
>
[ ... ]
> This is the database m
(sender, instance, signal, created, **kwargs):
"""When user is created also create a matching profile."""
from stentorian.report.models import UserProfile
if created:
UserProfile(user = instance).save()
On Thursday, July 5, 2012 1:06:26 PM UTC-4,
", "...
>
> Apparently, it did not create DB tables for the UserProfile model. I’m now
> getting this exception when I attempt to run the server:
>
> xception Type: DoesNotExist at /accounts/login/
> Exception Value: Site matching query does not exist.
>
> Among the addit
syncdb:
django.db.utils.DatabaseError: relation "report_userprofile" does not exist
LINE 1: INSERT INTO "report_userprofile" ("user_id", "first_name", "...
Apparently, it did not create DB tables for the UserProfile model. I’m now
getting this exception whe
In the filter, you are trying the filter User objects on timestamp field
which does not exist.
In line 42 of admin.py, try filtering on "userprofile__timestamp__gte"
-Sandeep
On Thursday, June 28, 2012 1:20:03 PM UTC+5:30, yillkid wrote:
>
> Hi all !
>
> I want filter
Hi all !
I want filter a field of UserProfile (field name: timestamp),
models.py: http://dpaste.com/764723/
admin.py: http://dpaste.com/764724/
But when I press the filter, browser show: http://dpaste.com/764725/
--- --- --- --- --- --- --- --- --- ---
According the error message, I
Hi all !
When I use UserProfile/UserCreationForm in Django 1.1,
everything is OK!
But in Django 1.4,
seems I can not hook my User Profile in Django User model,
when my UserProfile register into admin.site,
I need reload the browser 2nd times or error message will be show:
http
User model)
and their Profile information, but allow Admin user to access all the info.
My UserProfile model like this:
##models.py
##my smple profile
class UserProfile(models.Model):
user=models.OneToOneField(User)
extra_field=models.Charfield(max_length=100,blank=True)
My admin:
##admin.py
Oh. I see. So...that wasn't very complicated at all then, was it?
Thanks DR - didn't realize you could access userprofile directly from
user that way.
On Mar 27, 2:31 am, Daniel Roseman wrote:
> On Tuesday, 27 March 2012 02:15:04 UTC+1, bcrem wrote:
>
> > Hello Django
user profile class associated with each user,
> UserProfile, accessible through the usual User.get_profile()
> 3. UserProfile has a status variable, UserProfile.status, which can
> be 'Active', 'Inactive', or 'Deleted'
>
> I'm trying to display
Hello Django Nerds!
So I have a (somewhat) complicated lookup I'm trying to do; here's the
gist of it:
1. I have a Store class, with a User ManyToManyField, Store.users
2. I have a user profile class associated with each user,
UserProfile, accessible through the usual User.g
Thanks tom,
that worked and now understand what i was doing wrong.
much appreciated.
On Feb 24, 7:08 am, Tom Evans wrote:
> On Fri, Feb 24, 2012 at 2:55 PM, richard wrote:
> > Hi Tom,
>
> > Thanks for your reply. So for clarity i thought i was getting the
> > user
On Fri, Feb 24, 2012 at 2:55 PM, richard wrote:
> Hi Tom,
>
> Thanks for your reply. So for clarity i thought i was getting the
> userprofile to pass into the bound form so that the userprofile_id in
> the UserProfilePic would get populated/saved. as if i leave the
> instance as
Hi Tom,
Thanks for your reply. So for clarity i thought i was getting the
userprofile to pass into the bound form so that the userprofile_id in
the UserProfilePic would get populated/saved. as if i leave the
instance as None
then i get an error saying that userprofile_id cannot be empty? also,
is
= UserProfilePic
> fields = ('profilepic',)
>
> […]
>
> form = UserProfilePicForm(instance=u.get_profile())
u.get_profile() returns a UserProfile. Your form definition says that
this form is for a UserProfilePic model.
Cheers
Tom
--
You received this message beca
Hi, Am i doing this in the correct way? I am trying to accomplish a
UserProfile having multiple profile images. IE if a user uploads a
profile photo it gets saved as the default profile pic but if they
upload another pic then that becomes the default pic but i need to
keep records of all the
Sun, Feb 12, 2012 at 6:06 AM, richard wrote:
> > Hi im having difficulty looping over my mantomany in my template. A
> > user has a 1to1 with UserProfile and the UserProfile has a manytomany
> > with interests. But displaying the form field without looping over it
> >
On Sunday, 12 February 2012 11:06:32 UTC, richard wrote:
>
> Hi im having difficulty looping over my mantomany in my template. A
> user has a 1to1 with UserProfile and the UserProfile has a manytomany
> with interests. But displaying the form field without looping over it
> d
ck
On Sun, Feb 12, 2012 at 6:06 AM, richard wrote:
> Hi im having difficulty looping over my mantomany in my template. A
> user has a 1to1 with UserProfile and the UserProfile has a manytomany
> with interests. But displaying the form field without looping over it
> displays a mode
Hi im having difficulty looping over my mantomany in my template. A
user has a 1to1 with UserProfile and the UserProfile has a manytomany
with interests. But displaying the form field without looping over it
displays a model multiple select with just a list of object result
sets. displaying
On Tue, 2011-06-21 at 12:49 +0100, Tom Evans wrote:
> >> It will still work perfectly with ForeignKey(unique=True),
> >
> > the docs say one2one
> >
>
> That doesn't negate my statement.
>
> You said that User.get_profile() will only work with OneToOneField,
> which is incorrect, it will also wor
On Sat, Jun 18, 2011 at 8:27 AM, Kenneth Gonsalves
wrote:
> On Thu, 2011-06-16 at 12:13 +0100, Tom Evans wrote:
>> On Thu, Jun 16, 2011 at 11:55 AM, Kenneth Gonsalves
>> wrote:
>> > those entries are old. The point is that the built in
>> User.get_profile()
>> > only works with onetoone. The diff
On Thu, 2011-06-16 at 12:13 +0100, Tom Evans wrote:
> On Thu, Jun 16, 2011 at 11:55 AM, Kenneth Gonsalves
> wrote:
> > those entries are old. The point is that the built in
> User.get_profile()
> > only works with onetoone. The difference is in the reverse lookup.
>
> That is not correct.
>
> It
On Thu, Jun 16, 2011 at 11:55 AM, Kenneth Gonsalves
wrote:
> those entries are old. The point is that the built in User.get_profile()
> only works with onetoone. The difference is in the reverse lookup.
That is not correct.
It will still work perfectly with ForeignKey(unique=True), it is just
be
On Thu, 2011-06-16 at 12:24 +0200, Ivo Brodien wrote:
> This Django Book however is old and in the new one in Chapter 14:
> Sessions, Users, and Registration the User Profile does not get
> mentioned anymore.
>
> Also the first search result in google for “django user profile” is
> James Bennetts
> In the paragraph preceding this link it explicitly states to use
> OneToOneField. The Django documentation is canonical, if it says one
> thing, and elsewhere on the internet says something else, the internet
> is wrong. The internet is often wrong.
>
> The difference between a ForeignKey(unique
On Thu, Jun 16, 2011 at 11:24 AM, Ivo Brodien wrote:
>
> Actually, I've read that ForeignKey is now the way to specify it.
>
> unique foreign key *was* the correct way as onetoone was broken. This is
> no longer true.
>
> where is the most up to date info on this?
> In the dev docs about storing a
>> Actually, I've read that ForeignKey is now the way to specify it.
>
> unique foreign key *was* the correct way as onetoone was broken. This is
> no longer true.
where is the most up to date info on this?
In the dev docs about storing additional user info on djangoproject.com there
is a lin
On 16/06/2011 11:29, Kenneth Gonsalves wrote:
> On Thu, 2011-06-16 at 11:10 +0200, Benedict Verheyen wrote:
>> On 16/06/2011 10:43, Kenneth Gonsalves wrote:
>>> On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote:
user = models.ForeignKey(User, unique=True)
>>>
>>> you need onetoone for
On Thu, 2011-06-16 at 11:10 +0200, Benedict Verheyen wrote:
> On 16/06/2011 10:43, Kenneth Gonsalves wrote:
> > On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote:
> >> user = models.ForeignKey(User, unique=True)
> >
> > you need onetoone for this to work.
>
> Hi,
>
> Actually, I've read
On 16/06/2011 10:43, Kenneth Gonsalves wrote:
> On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote:
>> user = models.ForeignKey(User, unique=True)
>
> you need onetoone for this to work.
Hi,
Actually, I've read that ForeignKey is now the way to specify it.
Anyway, the problem has been so
On 16/06/2011 10:27, Ivo Brodien wrote:
> an idea: Do you have a __init__.py in every subfolder? also the models and
> userprofile folder under calltracking_main ?
>
>
Ivo,
i do have an __init__.py in every folder.
As Jari pointed out, it was the appname in my UserProfile mo
On 16/06/2011 10:25, Jani Tiainen wrote:
> On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote:
>> Hi,
>>
>>
>> The syncdb command doesn't want to create the UserProfile table.
>> Also when I was trying to get this working while runnin
On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote:
> user = models.ForeignKey(User, unique=True)
you need onetoone for this to work.
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/
--
You received this message because you are subscribed to th
an idea: Do you have a __init__.py in every subfolder? also the models and
userprofile folder under calltracking_main ?
On Jun 16, 2011, at 10:10 AM, Benedict Verheyen wrote:
> Hi,
>
>
> The syncdb command doesn't want to create the UserProfile table.
> Also when I wa
On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote:
> Hi,
>
>
> The syncdb command doesn't want to create the UserProfile table.
> Also when I was trying to get this working while running the app,
> it was complaining about AUTH_PROFILE_MODULE.
> It is however
Hi,
The syncdb command doesn't want to create the UserProfile table.
Also when I was trying to get this working while running the app,
it was complaining about AUTH_PROFILE_MODULE.
It is however correctly specified in my settings.py:
...
AUTH_PROFILE_MODULE = 'calltracking_main.U
The issue seems to come from the fact that the order of operations
when you create the user looks like this:
1) Django admin saves the new User
2) post_save on User is triggered, and User's profile is created
3) Django admin saves the UserProfile... but it already exists, and an
integrity
Ok, kenneth i havent seen it that way.
I will use your model.
I really apreciate it
Thanks
ignacio Soto Reveco
Staff IngeHost
El 12-06-2011 0:39, "Kenneth Gonsalves" escribió:
On Sat, 2011-06-11 at 21:12 -0400, Ignacio Soto wrote:
> No, the same person cant be costumer and se...
I have a bas
On Sat, 2011-06-11 at 21:12 -0400, Ignacio Soto wrote:
> No, the same person cant be costumer and seller.
I have a basic profile with information common to both customer and
seller called Person and separate models called customer and seller with
foreign key to person. Thus one person may have mul
On Sun, Jun 12, 2011 at 6:42 AM, Ignacio Soto wrote:
> No, the same person cant be costumer and seller.
>
Then why not have a 'type' in your profile which tracks the user type?
-V
http://blizzardzblogs.blogspot.com/
--
You received this message because you are subscribed to the Google Groups
No, the same person cant be costumer and seller.
ignacio Soto Reveco
Staff IngeHost
El 11-06-2011 21:37, "Kenneth Gonsalves" escribió:
On Fri, 2011-06-10 at 23:51 -0400, Ignacio Soto wrote:
> i want to create 2 user profile: cutomer an...
can the same person be both customer and seller?
--
rega
On Fri, 2011-06-10 at 23:51 -0400, Ignacio Soto wrote:
> i want to create 2 user profile: cutomer and seller with diferents
> fields
> and quantity of fields
can the same person be both customer and seller?
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.or
Ok, thannks i will try, and let you know...
Cheers
ignacio Soto Reveco
Staff IngeHost
El 11-06-2011 11:41, "Shawn Milochik" escribió:
Oops, correction: You'd use user.seller_profile and user.customer_profile if
you've set it up as a OneToOneField -- the get() is unnecessary (and won't
work).
Oops, correction: You'd use user.seller_profile and user.customer_profile if
you've set it up as a OneToOneField -- the get() is unnecessary (and won't
work).
You'd use get() if you used a ForeignKey with unique = True, but that's
silly because a OneToOneField does exactly that but more explici
Just make your models for the customer and seller profiles, and attach
them to users with a OneToOne field. You can only specify one to be used
with User.get_profile(), but I've learned from discussions among core
developers that get_profile() is something many consider useless. It's
even been
Hi there...
i want to create 2 user profile: cutomer and seller with diferents fields
and quantity of fields
but there is a problem with Get_Profile()
i've reading about it and i found some inheritance hacks.. but i doubt it
was the good way?
what is the right way to do it?
thanks
--
__
Ignac
I can confirm that I get the same error. I wonder if it is anything to do
with the two different forms auth uses for user creation and change?
On a side note, how did you get your code so nicely formatted?
Ryan
--
You received this message because you are subscribed to the Google Groups
"Dj
On 26 May 2011 10:23, Jani Tiainen wrote:
> If I extend auth.User with custom profile and add automatic profile
> creation signal it works as expected.
>
> But if I try to add admin inline editor for profile when saving I get
> exception about integration violation.
>
> It happens because admin t
If I extend auth.User with custom profile and add automatic profile
creation signal it works as expected.
But if I try to add admin inline editor for profile when saving I get
exception about integration violation.
It happens because admin tries to create second profile for user when
saving.
I
Hello friends, I have the following models,
the problem is that the fields null = True and blank = True,
are being validated when they should enter zero plumb, can someone help me?
class UserProfile(models.Model):
sexo =
models.CharField(choices=(("masculino","masculi
On Mar 23, 2011, at 4:25 AM, Malcolm Box wrote:
> Further investigation: looks like it's a South/syncdb interaction. The
> UserProfile will be created by the south migration, but of course that
> hasn't run when the auth post_install runs to prompt for a superuser.
>
&g
Further investigation: looks like it's a South/syncdb interaction. The
UserProfile will be created by the south migration, but of course that
hasn't run when the auth post_install runs to prompt for a superuser.
Sadly syncdb --migrate doesn't do the right thing either.
For now, I&
and answer yes.
But when the user is created, I get a django.db.utils.DatabaseError:
(1146, "Table 'x.x_userprofile' doesn't exist"), because the
userprofile table from my app hasn't been created yet.
This must be a common problem, but I can't find a recommen
I use extended UserProfile. Now I want to make a profile edition. I need to
place all my custom profile fields and email, firstname, lastname from
original User model.
I try to do this, but can't make it work. Email field is not shown. None of
the User model are shown.
My forms:
request.user.get_profile().avatar_url
Assuming you have set a AUTH_PROFILE_MODULE in settings, and send the
request context when rendering.
On Oct 13, 5:19 am, reduxdj wrote:
> I have a simple use-case. I want the user's profile to be available to
> the context instance. For instance, the user's
Take a look at my site: http://www.wcfree.com you will have to
register etc but once you are done let me know if that is what you are
looking for with user profiles and having the image available etc...
If so I can help you.
PS: Make sure to email me your username after you are finished so i
can r
On Oct 13, 1:19 pm, reduxdj wrote:
> I have a simple use-case. I want the user's profile to be available to
> the context instance. For instance, the user's avatar image, i want
> them to be able to see it all the time. Is there way to make the user
> profile available to the context instance?
>
>
I have a simple use-case. I want the user's profile to be available to
the context instance. For instance, the user's avatar image, i want
them to be able to see it all the time. Is there way to make the user
profile available to the context instance?
Thanks,
Patrick
--
You received this message
On 8/23/2010 1:52 AM, adambossy wrote:
> I'm helping build a social networking site which makes heavy use of
> django built-in User model and its relationship to other Users on the
> site. We created a UserProfile per the django documentation [http://
> docs.djangoproject.com/e
I'm helping build a social networking site which makes heavy use of
django built-in User model and its relationship to other Users on the
site. We created a UserProfile per the django documentation [http://
docs.djangoproject.com/en/dev/topics/auth/#storing-additional-
information-about-
Django 1.2.1, with Python 2.6
I am trying to establish a many-to-many for a userprofile (working
with a legacy database so some of the field names are a little
strange...).
The models I have are:
class UserGrouping(models.Model):
#many-to-many
id = models.AutoField(primary_key=True
linsko
On Jun 2, 8:34 pm, kalinski wrote:
> Hi Djangos,
>
> i am attaching a UserProfile to my Users
> by using a post_save signal:
>
> class UserProfile(models.Model):
> user = models.ForeignKey(User, unique=True)
> address = models.ForeignKey(Address, blank=True, n
Hi Djangos,
i am attaching a UserProfile to my Users
by using a post_save signal:
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
address = models.ForeignKey(Address, blank=True, null=True)
def user_post_save(sender, instance, signal, *args, **kwargs
Hello.
I have problem with editing UserProfile through the admin interface.
I have such classes:
class UserProfile(models.Model):
user = models.OneToOneField(User)
credits = models.PositiveIntegerField()
class ModelProfile(UserProfile):
description = models.CharField(_('descri
Thank you for your comment. Well I need the following possibilities:
- Possibility to add payment methods in the admin without being fixed
to several choices
- Possibility to say:
Customer 1 has payment methods: PayPal, CreditCard
Customer 2 has payment methods: PayPal
etc.
So the ability to hav
I don't see much reason to keep Payment method separate from the Orders
class then. For each order, you can have a different payment method, so just
make a payment method column in the Orders model. Like this:
payment_method_choices = (
('$$', 'Cash'),
('cc', 'Credit Card'),
)
class Order
Yeah I understand that. But it makes no sense to link the payment
field in my Orders model to the CustomerProfile.
In the end I want to save one payment method from the methods that are
available for one specific user in my record for one order. I'm just
confused on how to achieve that. From a user
When you include the to_field, it tells Django that you want the foreignkey
to be the to_field on the CustomerProfile. It then looks for a field called
payment_id (following the foreignKey relationship). This is normal.
If you remove the to_field, it will choose the primary key of
CustomerProfile
Thank you for your response. But how would the Orders model field for
payment look like?
Should it look like that:
payment = models.ForeignKey(CustomerProfile,
related_name="order_customer_payment",verbose_name='Zahlungsart')
I don't understand how that should work. At the moment I am quite
conf
1 - 100 of 196 matches
Mail list logo