datetime.date is not json serializable

2016-02-19 Thread elcaiaimar
Hello, I'm having a problem when I try to convert a python dictionary into a json dictionary (*json.dumps(results, ensure_ascii=False)*). Everything is ok, but when there is a date as a valure of the dictionary I get this error: datetime.date is not json serializable. I don't know how to solve

Why does Django allow Circular Model Relation

2016-02-19 Thread Eddilbert Macharia
Hello All, I was working on a project, and realized that Django does not complain when you create Circular Model relationship even when creating migrations where i expected to have this complain e.g. the example does not make any sense as far as relationships go but it makes my point. class

Re: Why does Django allow Circular Model Relation

2016-02-19 Thread Javier Guerra Giraldez
On 19 February 2016 at 13:00, Eddilbert Macharia wrote: > Hello All, > > I was working on a project, and realized that Django does not complain when > you create Circular Model relationship even when creating migrations where i > expected to have this complain why would it complain? it might be

Re: Why does Django allow Circular Model Relation

2016-02-19 Thread Vadim Serdiuk
Why should it be complained? I know a lot of the same cases that may be applied. пятница, 19 февраля 2016 г., 15:00:12 UTC+2 пользователь Eddilbert Macharia написал: > > Hello All, > > I was working on a project, and realized that Django does not complain > when you create Circular Model relati

Django 1.9 + DRF causing strange issues

2016-02-19 Thread joe . simpson
Hi, I'm having a strange issue with Django 1.9 and Django Rest Framework 3.3. Most of the upgrade went well apart from one endpoint failing for a reason I can't figure out myself. Here's the traceback: Traceback (most recent call last): File "/home/ubuntu/something/sfm/somethingelse/tests/te

TypeError: view must be a callable or a list/tuple in the case of include()

2016-02-19 Thread ruben . charleville
Hi there. To test out django I created a Work_manager for a site, and created this for he urls.py: from django.conf.urls import include, url # from django.contrib import admin urlpatterns = [ # url(r'^admin/', admin.site.urls), url(r'^$', 'TasksManager.views.index.page'), url(r'^inde

Re: datetime.date is not json serializable

2016-02-19 Thread Tim Graham
datetime isn't JSON serializable by default. Django includes a custom encoder which handles datetime and some other types. You can use it like this: from django.core.serializers.json import DjangoJSONEncoder data = json.dumps(data, cls=DjangoJSONEncoder) On Friday, February 19, 2016 at 3:02:48

Re: TypeError: view must be a callable or a list/tuple in the case of include()

2016-02-19 Thread Tim Graham
You need to import your views and reference the callable as described at https://docs.djangoproject.com/en/stable/topics/http/urls/#example. Referencing the view by string using patterns() is deprecated: https://docs.djangoproject.com/en/stable/releases/1.8/#django-conf-urls-patterns On Friday,

Re: Why does Django allow Circular Model Relation

2016-02-19 Thread Eddilbert Macharia
Hello vadim when would such a relationship be needed I'm curious -- 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 p

Re: Why does Django allow Circular Model Relation

2016-02-19 Thread Tim Chase
On 2016-02-19 07:29, Eddilbert Macharia wrote: > Hello vadim when would such a relationship be needed I'm curious Think of a hierarchy at a company. Most employees have a supervisor. So your table would reference the supervisor in the same table: class Employee(models.Model): name = ...

Re: null datetime field and json fixtures

2016-02-19 Thread Malik Rumi
In [1]: import uuid In [2]: uuid.UUID('61877565-5fe5-4175-9f2b-d24704df0b74') Out[2]: UUID('61877565-5fe5-4175-9f2b-d24704df0b74') BUT In [3]: uuid.UUID4('61877565-5fe5-4175-9f2b-d24704df0b74') --- AttributeError

Re: Why does Django allow Circular Model Relation

2016-02-19 Thread Alex Heyden
You would use it any time the relationship means something different. It would generally be inappropriate to use it as a simple backwards relationship (Django does this for you), but there's no reason not to have multiple relationships in a number of directions. In an HR system, someone could be bo

problem with DJANGO_SETTINGS_MODULE

2016-02-19 Thread bob gailer
After several days of running my server with no problem I am suddenly confronted with: "django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call sett

Re: null datetime field and json fixtures

2016-02-19 Thread James Schneider
> > The only uuid currently in this fixture is the one I got from Django when > I put another model (only one row) in with a fixture (no date field) and it > worked. I needed the uuid of that object to put into the foreign key of the > model I am having trouble with now. > > > So I was sniffing aro

Re: Django 1.9 + DRF causing strange issues

2016-02-19 Thread James Schneider
On Fri, Feb 19, 2016 at 5:51 AM, wrote: > Hi, > > I'm having a strange issue with Django 1.9 and Django Rest Framework 3.3. > Most of the upgrade went well apart from one endpoint failing for a reason > I can't figure out myself. > > Here's the traceback: > > Traceback (most recent call last): >

Re: Django 1.9 + DRF causing strange issues

2016-02-19 Thread James Schneider
> > > Also, this SO post seems to have a resolution for this problem: > https://github.com/tomchristie/django-rest-framework/issues/1295 > Whoops... s/SO post/Github issue/ -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscrib

Re: TypeError: view must be a callable or a list/tuple in the case of include()

2016-02-19 Thread ruben . charleville
Many thanks Tim! Problem solved. Best Regards, Ruben -- 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

Gmail Django

2016-02-19 Thread setivolkylany
my settings EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = 'webmaster@vaility' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_FILE_PATH = None EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_PASSWORD = 'lv210493' EMAIL_HOST_USER = 'setivolkyl...@gmail.com' EMAIL_PORT = 587 EMAIL_SUBJECT_P

key specification without a key length

2016-02-19 Thread Sammi Singh
Hi, I'm new to Django and facing this error "*django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id' used in key specification without a key length")*" Here is my code: class Steps(models.Model): author = models.ForeignKey(User) #id = models.TextField(primary_key=True)

1170, "BLOB/TEXT column

2016-02-19 Thread Sammi Singh
Hi, I'm new wot Django and stuck with below error when run migrate. Any suggestions?? *django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id' used in key specification without a key length")* Here is my code: class Steps(models.Model): author = models.ForeignKey(User) #id =

Re: Gmail Django

2016-02-19 Thread m1chael
You may have to dig deep in Google's settings and turn off a lot of security, don't give up, this is an annoying one. On Fri, Feb 19, 2016 at 3:17 PM, wrote: > my settings > > EMAIL_USE_TLS = True > DEFAULT_FROM_EMAIL = 'webmaster@vaility' > EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailB

Re: Gmail Django

2016-02-19 Thread Daniel Wilcox
You should generate a certificate to use TLS (even something self signed, or try Let's Encrypt and get a free cert from there). Other than that we have the same settings and I've been sending mail successfully with almost identical settings the past day or so. I presume you are using an app-speci

Re: Gmail Django

2016-02-19 Thread Luis Zárate
Those are your real credentials, hurry up and change the password, you must never post your real credentials in public mail list. M1chael is right you need to change the gmail settings for allow login with insecure applications. 2016-02-19 16:03 GMT-06:00 Daniel Wilcox : > You should generate a

Re: key specification without a key length

2016-02-19 Thread Mike Dewhirst
On 20/02/2016 6:26 AM, Sammi Singh wrote: Hi, I'm new to Django and facing this error "*/django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id' used in key specification without a key length")/*" Here is my code: class Steps(models.Model): Â Â author = models.ForeignKey(User) #Â

Re: null datetime field and json fixtures

2016-02-19 Thread Michal Petrucha
On Fri, Feb 19, 2016 at 10:20:42AM -0600, Malik Rumi wrote: > In [1]: import uuid > > In [2]: uuid.UUID('61877565-5fe5-4175-9f2b-d24704df0b74') > Out[2]: UUID('61877565-5fe5-4175-9f2b-d24704df0b74') > > BUT > > In [3]: uuid.UUID4('61877565-5fe5-4175-9f2b-d24704df0b74') >

Re: 1170, "BLOB/TEXT column

2016-02-19 Thread Luis Zárate
Check your migrations, I think you use TextField the first time, run makemigrations and create the initial migrations, before you run migrate django raise a exception so you change it for CharField and run makemigrations a second time and create the correction in the 002 migration but the initial

Re: key specification without a key length

2016-02-19 Thread Luis Zárate
I response in the other mail, but I am curious changing TextField for. CharField with max_length has big impact in the database performance. I saw you have a lot of TextFields so are you sure that you need all those TextFields ? Or y could you change those TextFields for CharFields with a small ma