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)

Django 1.8 Transaction Begin

2015-06-17 Thread Katarzyna Łabędź
Hi! As far as i know Django 1.8 does not support BEGIN transaction for mysql. Is there a way to invoke this? How to invoke BEGIN Transaction in a raw sql? I cannot find it in documentation... -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Shortcut for Date and Time is missing from the Django admin panel

2015-06-17 Thread aRkadeFR
Hello, What's your problems with date and time? Which shortcuts are you talking about? On 06/17/2015 10:55 AM, vishwa raj wrote: I am very new django user. Here I am facing something troubles In the date and time shortcut. Also I need to learn it ASAP. This would be my first backend language. S

ValueError during migrations.RunPython to create OneToOne records in new model

2015-06-17 Thread Gergely Polonkai
Hello, I have created a new model called Settings, which has a OneToOneField(User, primary_key=True) field. After the automatically created migrations.CreateModel() invocation I added a RunPython line that runs this function: def create_user_settings(apps, schema_editor): User = get_user_mode

Re: ValueError during migrations.RunPython to create OneToOne records in new model

2015-06-17 Thread Markus Holtermann
Hi Gergely, You need to use apps.get_model() instead of get_user_model(). See https://docs.djangoproject.com/en/1.8/topics/migrations/#data-migrations /Markus On June 17, 2015 12:48:48 PM GMT+02:00, Gergely Polonkai wrote: >Hello, > >I have created a new model called Settings, which has a >O

Re: ValueError during migrations.RunPython to create OneToOne records in new model

2015-06-17 Thread Gergely Polonkai
Hello Markus, thanks for the pointer. Just for the record, if you want to use it in a reusable app, you should do this: User = apps.get_model(django.conf.settings.AUTH_USER_MODEL) Best, Gergely 2015-06-17 13:14 GMT+02:00 Markus Holtermann : > Hi Gergely, > > You need to use apps.get_model() in

custom model fields with to_python()/from_db_value() for different django version...

2015-06-17 Thread Jens Diemer
("Moved" from django-developers list) Am 17.06.2015 um 16:48 schrieb charettes:> Hi Jens, > > I'm not sure I understand what you are trying to achieve but I assume you want > to write a third-party field that supports both Django 1.7 and 1.8 without > raising deprecating warnings? > > I suggest y

Get the name of the method in QuerySetAPI

2015-06-17 Thread Utkarsh
I am trying to log overridden calls to QuerySetAPI. Say I am calling Example.objects.filter(id=1)and I have following code in Models.py objects = MyManager() and in MyManager I have- class MyManager(Manager): def get_query_set(self): # logging stuff I am doing return super

Re: custom model fields with to_python()/from_db_value() for different django version...

2015-06-17 Thread Simon Charette
Hi Jens, I haven't tested your alternative but it looks like it would work. I prefer the explicit check against django.VERSION since it makes it easy to search for dead code branch when dropping support a version of Django. Simon Le mercredi 17 juin 2015 10:59:27 UTC-4, Jens Diemer a écrit : >

Re: Get the name of the method in QuerySetAPI

2015-06-17 Thread Simon Charette
Hi Utkarsh, I guess you could define a __getattribute__[1] method on your manager? from django.db import models class MyManager(models.Manager): def __getattribute__(self, name): print(name) return super(models.Manager, self).__getattribute__(name) Simon [1] https://docs.p

Re: Get the name of the method in QuerySetAPI

2015-06-17 Thread Utkarsh J
Simon, I guess that is not what I am looking for. It will print "get_query_set" I am more interested in getting the names of methods. On 17 June 2015 at 11:59, Simon Charette wrote: > Hi Utkarsh, > > I guess you could define a __getattribute__[1] method on your manager? > > from django.db impo

Re: Get the name of the method in QuerySetAPI

2015-06-17 Thread Utkarsh J
Also, in https://github.com/django/django/blob/master/django/db/models/manager.py#L126 Is `manager_method.__name__` name of the query set Method? On 17 June 2015 at 13:47, Utkarsh J wrote: > Simon, > > I guess that is not what I am looking for. It will print "get_query_set" > I am more intereste

Re: Django 1.8 Transaction Begin

2015-06-17 Thread Russell Keith-Magee
Hi Katarzyna, I'm not sure what gave you the impression that Django doesn't support transactions - there's a whole section in the documentation about this very topic: https://docs.djangoproject.com/en/1.8/topics/db/transactions/ You don't explicitly execute a "BEGIN" statement, but you can defin