Django self reference (FK) change SQL result

2018-12-11 Thread madjardi
Good day for Everyone. Because I have self-reference, my queryset no work properly I have a model class Agency(Organization): organization_ptr = models.OneToOneField(to='Organization', parent_link=True, primary_key=True, related_name='%(class)s', serialize=False, on_delete=CASCADE) acc

Re: Help with data bound ModelChoiceField

2018-12-11 Thread madjardi
aybe it help You https://stackoverflow.com/questions/42157384/django-how-to-change-value-of-forms-modelchoicefield среда, 12 декабря 2018 г., 0:34:47 UTC+3 пользователь progm...@gmail.com написал: > > Hi, > I'm struggling to set up a data-bound(queryset) ModelChoiceField. Here is > the forms.py

Re: Help with data bound ModelChoiceField

2018-12-11 Thread madjardi
Inside dbCustomer среда, 12 декабря 2018 г., 0:50:46 UTC+3 пользователь madjardi написал: > > def __str__(self): >> >return "Custome" + self.id > -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Help with data bound ModelChoiceField

2018-12-11 Thread madjardi
> > def __str__(self): > return "Custome" + self.id -- 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

Django "self" foreign key change SQL query

2018-12-11 Thread madjardi
Good day for Everyone. Because I have self-reference, my queryset no work properly I have a model class Agency(Organization): organization_ptr = models.OneToOneField(to='Organization', parent_link=True, primary_key=True, related_name='%(class)s', serialize=False, on_delete=CASCADE) acc

explain me why django-migration defer from sqlall and raise exception in exist table

2015-06-17 Thread madjardi
i have existing table created by FDW (Foreign data wrappers ) named 'stateagency_stateagency'. two models class StateAgency(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=100)

Re: delete OnetoOneField link

2014-12-30 Thread madjardi
er.cashbox > > instead of Cashbox.objects.get > > A more definite solution would be to add the OneToOne relation to the User > model instead of the Cashbox object, but I'm not sure how that works in > your project. > > On Tue, Dec 30, 2014 at 6:56 AM, madjardi >

delete OnetoOneField link

2014-12-30 Thread madjardi
class Cashbox(models.Model): cashier = models.OneToOneField('User', null=True, blank=True, related_name='cashbox', on_delete=models.SET_NULL) in other code: User.object.get(pk=1) user.cashbox = None AttributeError: 'NoneType' object has no attribute 'cashier_id' one version solving is: c1 =