Re: REST Framework, choices fields

2014-10-25 Thread Lachlan Musicman
Done. long_type = serializers.CharField(source='get_FOO_display') On 26 October 2014 14:38, Lachlan Musicman wrote: > When using GET to retrieve data, how do I populate the JSON with > get_FOO_display rather than FOO? > > cheers > L. > > -- > You have to be really clever to come up with a genui

REST Framework, choices fields

2014-10-25 Thread Lachlan Musicman
When using GET to retrieve data, how do I populate the JSON with get_FOO_display rather than FOO? cheers L. -- You have to be really clever to come up with a genuinely dangerous thought. I am disheartened that people can be clever enough to do that and not clever enough to do the obvious thing a

Re: migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)

2014-10-25 Thread JJ Zolper
So I believe I have solved my issue. It has to do with the inexperience I still have with migrations and how certain aspects are approached. I was not aware of this issue until now: https://docs.djangoproject.com/en/1.7/ref/models/fields/#foreignkey Warning It is not recommended to have a Fore

Re: Decimal value allowed for auto primary key

2014-10-25 Thread Kafex
Whoops... just to clarify... FruitType.objects.get(id=2.9) # Gets me the apple I meant to comment that this gets me the orange. On Saturday, October 25, 2014 8:37:55 PM UTC-4, Kafex wrote: > > If I have the following model... > class FruitType(models.Model): > name = models.CharField(max_leng

Re: Integer Form with Select Widget?

2014-10-25 Thread Farhan Khan
Any takers? I suspect that I need to mess around with the form during instantiation, but not sure how. On Saturday, October 25, 2014 12:29:45 PM UTC-4, Farhan Khan wrote: > > Hi all, > > I want to get an Integer value from the user through a forms.Form. I have > three unique requirements for it.

Decimal value allowed for auto primary key

2014-10-25 Thread Kafex
If I have the following model... class FruitType(models.Model): name = models.CharField(max_length=255) And I insert some records... FruitType.objects.create(name="Apple") FruitType.objects.create(name="Orange") Why is this valid? FruitType.objects.get(id=1.2) # Gets me the apple FruitType.obje

Re: migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)

2014-10-25 Thread JJ Zolper
Carl, Thanks for responding and giving your input. I just made sure there were no other terminals with any sort of connection open. At times I have pgAdmin III open but that is currently closed and I ran migrate and same thing it hangs. The only other terminals I have are one terminal sitting a

Re: Problem with Pillow image resize and save

2014-10-25 Thread Aliane Abdelouahab
ah, ok :) just as another idea, you can handle the image uploads with Nginx, this will free Python from dealing static files. Le samedi 25 octobre 2014 20:31:35 UTC+1, John a écrit : > > That's a good idea, Aliane. In my case, the server was lightly loaded, > the conversion time is very short a

Re: New way to use URL dispatchers?

2014-10-25 Thread Aliane Abdelouahab
ah! thank you, because this is the 'cleanest' way, espetially for a beginner. thank you :) Le samedi 25 octobre 2014 21:04:49 UTC+1, Carl Meyer a écrit : > > > On Oct 24, 2014, at 8:37 PM, Russell Keith-Magee > wrote: > > When it is released, Django 1.8 will include support for the new preferred

Re: migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)

2014-10-25 Thread Carl Meyer
Hi JJ, One thing that can cause hangs when running migrations is having another process (say a ‘manage.py shell’) with a connection to the same database sitting open, possibly with a transaction in progress that is holding locks on the tables the migrations need to touch. Any possibility that’s

migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)

2014-10-25 Thread JJ Zolper
I really wish I could give some useful information in the terms of a traceback so others may have an idea what is happening to me but I'm completely serious when I say I don't even get a traceback right now. Here is the break down of what I did to give an idea of how I ended up at this point, h

Re: New way to use URL dispatchers?

2014-10-25 Thread Carl Meyer
> On Oct 24, 2014, at 8:37 PM, Russell Keith-Magee > wrote: > > When it is released, Django 1.8 will include support for the new preferred > format for URLpatterns. Django 1.7 doesn't support this new format, and the > documentation for version 1.7: > > https://docs.djangoproject.com/en/1.7/

Re: Problem with Pillow image resize and save

2014-10-25 Thread John
That's a good idea, Aliane. In my case, the server was lightly loaded, the conversion time is very short and the admin was only used by a very small number of users who were sufficiently patient. John On 25/10/14 20:23, Aliane Abdelouahab wrote: > You have to send the picture editing to another p

Re: Problem with Pillow image resize and save

2014-10-25 Thread Aliane Abdelouahab
You have to send the picture editing to another process, because you will block the operation untill the image will be converted! Le samedi 25 octobre 2014 19:23:33 UTC+1, John a écrit : > > On 25/10/14 15:26, Daniel Grace wrote: > > I need to include the following steps, but I don't know how

Re: Problem with Pillow image resize and save

2014-10-25 Thread John
On 25/10/14 15:26, Daniel Grace wrote: > I need to include the following steps, but I don't know how: > 1. copy the 'picture' file > 2. resize it (the copy) > 3. save it to the upload directory > 4. store it in the 'thumb' field > ... continue as before and save the 'profile'. > -- Daniel, I've

Re: How to get related data on one to one field of a foreign key?

2014-10-25 Thread Daniel Grace
I just used the following: {{ log.user.userprofile.picture }} ... and I didn't need the select_related. -- 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-us

TEST_MIRROR not working?

2014-10-25 Thread Ilya Baryshev
Hey all! I was writing tests for queries that use replica database, so I tried using TEST_MIRROR setting. TEST_MIRROR promises "connection to slave will be redirected to point at default. As

Integer Form with Select Widget?

2014-10-25 Thread Farhan Khan
Hi all, I want to get an Integer value from the user through a forms.Form. I have three unique requirements for it. 1. The corresponding Widget is Select or SelectMultiple (either one) 2. The 'choices' field is dynamic, not static or hard-coded -they are adjusted upon each display of t

How to get related data on one to one field of a foreign key?

2014-10-25 Thread Daniel Roseman
That's what you've already done with your select_related call. What you should have asked is how you access that data in the template, and the answer is that you simply follow the relationship from your Log object: {% for log in logs %} {{ log.myfield }} {{ log.userprofile.picture }} {%

How to get related data on one to one field of a foreign key?

2014-10-25 Thread Daniel Grace
Hi, I have a log table with a foreign key to the user table, and a userprofile table with a one to one field to the user table: class Log(models.Model): user = models.ForeignKey(User) ... class UserProfile(models.Model): user = models.OneToOneField(User) picture = models.ImageFie

Re: "autocommit cannot be used inside a transaction" error: trying to use a custom form with a CreateView

2014-10-25 Thread Michael
After furthing testing, I removed django_postgrespool (DATABASES['default']['ENGINE'] = 'django_postgrespool') and the error was finally more explicit about an integrity error. I was able to fix it and the error was gone. Why the error is not the actual error when using django_postgrespool? Th

Re: Merge two Databases into one

2014-10-25 Thread Majo
Larry's right, if it's a one time thing, use mysqldump -u YOUR_DB_USER -p OLD_DB --no-create-info > SOME_FILE.sql from the command line. Then, to import, use: mysqlimport -u YOUR_DB_USER -p NEW_DB SOME_FILE.sql To be sure you understand what's happening, check the docs first: http://dev.mysql.c

Re: Problem with Pillow image resize and save

2014-10-25 Thread Daniel Grace
I need to include the following steps, but I don't know how: 1. copy the 'picture' file 2. resize it (the copy) 3. save it to the upload directory 4. store it in the 'thumb' field ... continue as before and save the 'profile'. -- You received this message because you are subscribed to the Google

Dutch translation of Django Tutorial

2014-10-25 Thread Tomáš Ehrlich
Hello everyone, there are two things that going to happen in next month: 1. Django Under the Hood conference in Amsterdam 2. (Hopefully) I’ll finish SaaS for managing translations. The first frontend build on top of gettext message catalogues will be for Sphinx documentation. As a result, I woul