Re: OneToOneField value must be a model instance, not a value?

2019-01-02 Thread Kuber Sodari
>From official documentation "*to_field* is the field on the related object that the relation is to. By default, Django uses the primary key of the related object. If you reference a different field

Re: 'OneToOneField' object has no attribute 'get' in function-based view

2017-03-15 Thread Vijay Khemlani
At least I can help with the original problem Your view function should return an HttpResponse object, but inside your view you have this new_title = title_form.save() return new_title new_title is an instance of your ObjectName model, that's why Django crashes when it tries to use it as an Http

Re: 'OneToOneField' object has no attribute 'get' in function-based view

2017-03-15 Thread Pedro Paulo Palazzo
Here is the traceback: Environment: Request Method: POSTRequest URL: http://127.0.0.1:8000/work/add/ Django Version: 1.10.6Python Version: 3.6.0Installed Applications:['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.mess

Re: 'OneToOneField' object has no attribute 'get' in function-based view

2017-03-15 Thread Vijay Khemlani
Can you post the whole stack trace of the error? There are some things that don't make sense in the view function (for example returning "new_title" from the view) but they are not related to your initial error. On 3/15/17, Pedro Paulo Palazzo wrote: > > > I am writing a two-part form where I wa

Re: OneToOneField usage

2010-06-16 Thread bob84123
> Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? > > | class Person( Model ): > |    pass > | > | class Pet( Model ): > |    owner = OneToOneField( Person ) > | > | # Assuming "joe" exists as a Person > | >>> kitty = joe.pet > | DoesN

Re: OneToOneField usage

2010-05-14 Thread Peter Herndon
On May 14, 2010, at 5:43 AM, Tom Evans wrote: > On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: >> >> >> On May 13, 5:35 pm, Peter Herndon wrote: >>> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >>> Hello Django users, >>> Is there a particular reason why using a relat

Re: OneToOneField usage

2010-05-14 Thread Tom Evans
On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: > > > On May 13, 5:35 pm, Peter Herndon wrote: >> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >> >> > Hello Django users, >> >> > Is there a particular reason why using a related OneToOneField raises >> > DoesNotExist instead of returni

Re: OneToOneField usage

2010-05-13 Thread TallFurryMan
Thanks for this insight. I was using OneToOneField in the same way as ForeignKey. | class Person( Model ): | pass | | class Pet( Model ): | owner = ForeignKey( Person ) | | # Assuming "joe" exists as a Person | >>> kitty = joe.pet_set.get_or_create() Yes, in that situation "joe.pet_set" i

Re: OneToOneField usage

2010-05-13 Thread Daniel Roseman
On May 13, 5:35 pm, Peter Herndon wrote: > On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > > > Hello Django users, > > > Is there a particular reason why using a related OneToOneField raises > > DoesNotExist instead of returning None? > > Any query you make that is supposed to return one or

Re: OneToOneField usage

2010-05-13 Thread Peter Herndon
On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > Hello Django users, > > Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? Any query you make that is supposed to return one or more instances, that instead cannot find any results,

Re: OneToOneField, and inlines

2009-05-10 Thread nbv4
On May 10, 4:03 pm, Tom von Schwerdtner wrote: > Greetings folks, I've been wrestling with this and I really don't know > what I'm not doing right, so here is where I am: > > In basic pseudocode, I have: > > models.py: > --- > class Address(models.Model): >     ... ( street, city, e

Re: OneToOneField relation and bidirectional StackedInline behavior in contrib.admin context

2009-01-28 Thread peschler
Hi, actually I am facing the same problem here. I did quite a search on the subject and I found no real solution to this use case. Here are my models: --- contacts/models.py: class Address(models.Model): street = models.CharField(max_length=255) city = models.CharField(max_le

Re: OneToOneField relation and bidirectional StackedInline behavior in contrib.admin context

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 05:33 -0800, klein.steph...@gmail.com wrote: [...] > This error is understandable because actually ClassA haven't > ForeignKey but the relation > between ClassA and ClassB is OneToOneField then ClassA know how to > access to his classb object. > > This behavior is one missin

Re: OneToOneField blank=True null=True having an accident

2008-11-30 Thread stevedegrace
I found a solution on my own, and it's a doozy. If anyone can think of something a bit less ugly, let me know. The reason why the global variables are lists is to keep Python from trying to rebind the names as local variables inside the functions on assignment (the very behaviour that makes closur

Re: OneToOneField value not selected in default html form

2008-09-10 Thread Nathaniel Griswold
Oops, i thought I was running 1.0, but i thought wrong. Thanks -nate On Wed, Sep 10, 2008 at 9:45 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Wed, Sep 10, 2008 at 8:21 PM, nate <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> The values of OneToOneFields don't appear to remain selected after >>

Re: OneToOneField value not selected in default html form

2008-09-10 Thread Karen Tracey
On Wed, Sep 10, 2008 at 8:21 PM, nate <[EMAIL PROTECTED]> wrote: > > Hi, > > The values of OneToOneFields don't appear to remain selected after > creation or update in default forms (such as those used by the admin > interface). I Looked for a bug report but didnt see one. Has anyone > else run in

Re: OneToOneField('self') problem

2008-07-03 Thread Malcolm Tredinnick
On Thu, 2008-07-03 at 05:55 -0700, Aldo wrote: [...] > I have several problems on the admin site with this model : > -I cannot change 'married_to' field after object creation. Pretty much no work has been done on OneToOneField handling in existing (trunk) admin, since it's not worth it with newf

Re: OneToOneField

2008-06-14 Thread Russell Keith-Magee
On Sat, Jun 14, 2008 at 5:08 AM, Juanjo Conti <[EMAIL PROTECTED]> wrote: > > Is that last note the change mentioned in the first note? Is the first > note out of date? > > I'd like to use OneToOneField, but I'am note sure because of the first note. The second note is correct - OneToOneFields rece

Re: OneToOneField

2008-06-13 Thread Sebastian Bauer
second is true, you need to use OnetOneField(Model,primary=True) to make field primary_key Juanjo Conti pisze: > Here > http://www.djangoproject.com/documentation/db-api/#one-to-one-relationships > says: > > ''' > The semantics of one-to-one relationships will be changing soon, so we > don't re

Re: OneToOneField unchangeable

2008-04-13 Thread Manuel Meyer
> On Sun, Apr 13, 2008 at 8:34 AM, Manuel Meyer > <[EMAIL PROTECTED]> wrote: > > > No, that's they way it is documented as working. The one-to-one > > field acts as the primary key for the model, and primary keys can't > > be edited. From http://www.djangoproject.com/documentation/model- > > a

Re: OneToOneField unchangeable

2008-04-13 Thread Karen Tracey
On Sun, Apr 13, 2008 at 8:34 AM, Manuel Meyer <[EMAIL PROTECTED]> wrote: > > > No, that's they way it is documented as working. The one-to-one > > field acts as the primary key for the model, and primary keys can't > > be edited. From http://www.djangoproject.com/documentation/model- > > api/#on

Re: OneToOneField unchangeable

2008-04-13 Thread Manuel Meyer
> No, that's they way it is documented as working. The one-to-one > field acts as the primary key for the model, and primary keys can't > be edited. From http://www.djangoproject.com/documentation/model- > api/#one-to-one-relationships: > > This OneToOneField will actually replace the prima

Re: OneToOneField unchangeable

2008-04-10 Thread Karen Tracey
On Thu, Apr 10, 2008 at 10:31 AM, Manuel Meyer <[EMAIL PROTECTED]> wrote: > > Hey, > > I have a type Article in which i hold a Type HeaderImage within an > OneToOneField-Relationship. > When adding an article via contrib.admin interface everything works > as expected. > But if I edit an existing a

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
Karen Tracey wrote: > On 11/1/07, *George Vilches* <[EMAIL PROTECTED] > > wrote: > [snip] > > For reporting purposes though, we would like to be able to > .select_related() on User, and get a cached copy of each of the OneToOne > relationships. It seems rea

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread Karen Tracey
On 11/1/07, George Vilches <[EMAIL PROTECTED]> wrote: [snip] > For reporting purposes though, we would like to be able to > .select_related() on User, and get a cached copy of each of the OneToOne > relationships. It seems reasonable by the very essence of OneToOne, but > I don't know if there's

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread Malcolm Tredinnick
On Thu, 2007-11-01 at 08:53 -0400, George Vilches wrote: > (Off-list because this mostly doesn't apply to non qs-rf people) > > Thank you for the clarification on OneToOneFields and required > relationships. We've been working with a very high volume legacy > database that we're importing the

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
Alright, I guess it's not offlist. Sorry for the extra chatter folks. George Vilches wrote: > (Off-list because this mostly doesn't apply to non qs-rf people) > > Thank you for the clarification on OneToOneFields and required > relationships. We've been working with a very high volume legacy

Re: OneToOneField - ModelInheritance - Documentation samples

2007-05-11 Thread [EMAIL PROTECTED]
Hi :) Thank you very much for aswering again Malcolm. > The short answer is because select_related() does not work across > reverse links (the Place -> Restaurant direction). It also won't save > you any requests when model inheritance is implemented. I think I've already read it somewhere, but

Re: OneToOneField - ModelInheritance - Documentation samples

2007-05-11 Thread Malcolm Tredinnick
On Fri, 2007-05-11 at 08:13 -0700, [EMAIL PROTECTED] wrote: > Hello again DjangoUsers, > > Thank you for your reply Malcolm, actually my problem remained in the > fact my own object name was not "Restaurant" but something like > "ItalianRestaurant", and I only tried to call it from places by > "i

Re: OneToOneField - ModelInheritance - Documentation samples

2007-05-11 Thread [EMAIL PROTECTED]
Hello again DjangoUsers, Thank you for your reply Malcolm, actually my problem remained in the fact my own object name was not "Restaurant" but something like "ItalianRestaurant", and I only tried to call it from places by "italianRestaurant", as I would have done in Java reflect for example, I d

Re: OneToOneField - ModelInheritance - Documentation samples

2007-05-11 Thread Malcolm Tredinnick
On Fri, 2007-05-11 at 04:57 -0700, [EMAIL PROTECTED] wrote: > Hello Djangousers, > > I'm quite young with Django, so I apologize for my question. > > > I just tried to do exactly what is written on OneToOneField (http:// > www.djangoproject.com/documentation/models/one_to_one/) and > ModelInher

Re: OneToOneField and edit_inline

2006-12-18 Thread Rob Slotboom
Maybe we should create some kind of pressure group for this :-) I don't have any idea who can be consulted for this subject, do you? Cheers, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: OneToOneField and edit_inline

2006-12-18 Thread Dirk Eschler
On Monday 18 December 2006 22:49, Rob Slotboom wrote: > > I'd like to be able to edit Project and News separately with Content > > inline instead. Do you know what i mean? > > Hi Dirk, > > I get the point though I think this will not work. I've tried similar > things when creating a menu, where a

Re: OneToOneField and edit_inline

2006-12-18 Thread Rob Slotboom
> I'd like to be able to edit Project and News separately with Content inline > instead. Do you know what i mean? Hi Dirk, I get the point though I think this will not work. I've tried similar things when creating a menu, where a menu "one to oned" to a poll item or blog entry. I gave up. In th

Re: OneToOneField and edit_inline

2006-12-18 Thread Dirk Eschler
On Saturday 16 December 2006 12:07, Rob Slotboom wrote: > Hi Dirk, > I think it's the other way around, try this > > > class Content(models.Model): > title = models.CharField('Title', maxlength=255, core=True) > body = models.TextField('Body text') > > class Admin: > fields =

Re: OneToOneField and edit_inline

2006-12-16 Thread Rob Slotboom
Hi Dirk, I think it's the other way around, try this class Content(models.Model): title = models.CharField('Title', maxlength=255, core=True) body = models.TextField('Body text') class Admin: fields = ( (None, {'fields': ('title','body',)}), ) list_disp

Re: OneToOneField

2006-03-29 Thread Joseph Kocherhans
On 3/29/06, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > > If someone would file a ticket for this (if they haven't already) that > would be great. I'll look at it in a few days if no one else has. I'm > trying to wrap up some other project this week. Oops. Nevermind about filing a ticket. I mi

Re: OneToOneField

2006-03-29 Thread Joseph Kocherhans
On 3/29/06, layik <[EMAIL PROTECTED]> wrote: > > Hello there, > > sorry to bother you. > > I was wondering if you have solved your OneToOne problem. if so could > let me know how I could solve it as well?? > thanks > > > ChaosKCW wrote: > > Agreeded, I am trying to use OneToOne in MR branch and ge

Re: OneToOneField

2006-03-29 Thread layik
Hello there, sorry to bother you. I was wondering if you have solved your OneToOne problem. if so could let me know how I could solve it as well?? thanks ChaosKCW wrote: > Agreeded, I am trying to use OneToOne in MR branch and get the same > problems. > > I have: > > class Employee(models.Mode

Re: OneToOneField

2006-03-29 Thread layik
might be a too late reply but could any of you tell me what MR Branch or svn Trunk that you are tlkaing about is? I am sorry I dont know any of them. I still have the problem unsolved. thanks --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: OneToOneField

2006-03-24 Thread olive
OK, you do, not the original poster. Anyway, I've heard that subclassing has been improved in MR. Why don't you use that instead ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: OneToOneField

2006-03-24 Thread ChaosKCW
That would be why yours works, this is specific to MR as stated above. --~--~-~--~~~---~--~~ 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 unsu

Re: OneToOneField

2006-03-24 Thread olive
No, an up to date svn trunk. --~--~-~--~~~---~--~~ 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 [EM

Re: OneToOneField

2006-03-24 Thread ChaosKCW
Hi Are you using the MR Branch for the OneToOne on User ? Thx, S --~--~-~--~~~---~--~~ 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 unsub

Re: OneToOneField

2006-03-24 Thread olive
Strange, OneToOne works pretty well for me to extend User model (I would prefer to subclass but without having new database tables). On the contrary, I had many problem with OneToOne to extend my own model(s), I use ForeignKey with intermediary model and Inline Edit instead. hth --~--~

Re: OneToOneField

2006-03-23 Thread ChaosKCW
That is definatly not the problem. OneToOne just doesnt work with User. --~--~-~--~~~---~--~~ 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 un

Re: OneToOneField

2006-03-22 Thread Joseph Heck
The error "no such column" suggests that your schema is out of whack with your model.Use the 'python manage.py sqlall [APPLICATIONNAME]' to determine what Django thinks your schema should be, and compare that to what is there. While doing heavily development, I use a script to rebuild the whole kit

Re: OneToOneField

2006-03-21 Thread layik
please help! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] F

Re: OneToOneField

2006-03-21 Thread ChaosKCW
PS Using ForeignKey works fine. So that my solution for now. --~--~-~--~~~---~--~~ 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 fr

Re: OneToOneField

2006-03-21 Thread ChaosKCW
Agreeded, I am trying to use OneToOne in MR branch and get the same problems. I have: class Employee(models.Model): user = models.OneToOneField(User, verbose_name='Employees User ID') ... And get the following error when trying to view the object in admin: Request Method: GET Req

Re: OneToOneField

2006-03-21 Thread layik
Kenneth Gonsalves wrote: > On Tuesday 21 Mar 2006 5:52 am, layik wrote: > > Class member: > > username = meta.foreignKey (users) > > email = charfield > > this is not onetoone > -- > regards > kg > > http://www.livejournal.com/users/lawgon > tally ho! http://avsap.org.in > ಇಂಡ್ಲಿನಕ್ಸ வாழ்க! that

Re: OneToOneField

2006-03-20 Thread Kenneth Gonsalves
On Tuesday 21 Mar 2006 5:52 am, layik wrote: > Class member: > username = meta.foreignKey (users) > email = charfield this is not onetoone -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.in ಇಂಡ್ಲಿನಕ್ಸ வாழ்க! --~--~-~--~~~---~--~~

Re: OneToOneField

2006-03-20 Thread layik
bruno desthuilliers wrote: > layik wrote: > > is the bug fixed? > > Which one ? and in which version ? > > > I didnt quite understand the previous topics. > > could anyone please tel me what I need to be aware of when trying to > > extend tables and using OneToOneField > > > > many thanks > > > >

Re: OneToOneField

2006-03-20 Thread bruno desthuilliers
layik wrote: > is the bug fixed? Which one ? and in which version ? > I didnt quite understand the previous topics. > could anyone please tel me what I need to be aware of when trying to > extend tables and using OneToOneField > > many thanks > > > > > -- bruno desthuilliers développeu

Re: OneToOneField and its usage

2006-02-22 Thread [EMAIL PROTECTED]
title = meta.OneToOneField(Title, core=True) ... # works but nothing displays should be #installs and doesn't complain but no sub fields display # AND I feel this is due to the fact that the ill formed SQL query string in the next example isn't executed [EMAIL PROTECTED] wrote: > Hi All, > > Bee

Re: OneToOneField bug fixed

2005-11-21 Thread plisk
Also getting error when trying to get_list, details follow model addition to posted above class PolicyConfirmation(meta.Model): policy = meta.ForeignKey(Policy) userdetail = meta.ForeignKey(UserDetail) date_added = meta.DateTimeField(default=meta.LazyDate()) code from django.mo

Re: OneToOneField bug fixed

2005-11-21 Thread plisk
Seems like its become broken even more, as for me with the following model from django.core import meta from django.models.auth import User class PolicyCategory(meta.Model): name = meta.CharField(maxlength=100); def __repr__(self): return self.name class META: db_ta