django / tastypie - how to exclude a resource attribute from obj_create, but keep it for listing

2015-01-27 Thread Eugene Goldberg
I have the following tastypie resource: class WorkloadResource(ModelResource): # blueprints = ManyToManyField(Blueprint, 'blueprints') blueprint = fields.OneToManyField('catalog.api.BlueprintResource', attribute='blueprint', related_name='worklo

How to properly set the initial value for a Form ChoiceField

2015-01-23 Thread Eugene Goldberg
Hello, In my Form I have a couple of ChoiceField fields, for which I need to set a default / initial value. I'm trying to do this in the __init__, and my debug shows, that these values do take, but, when the actual html forms shows up, my default values are not set as desired. Am I missing somet

Django and Windows Forms application data exchange?

2011-12-07 Thread Eugene Goldberg
Hello! Could you please give me a piece of advice? I've got two applications: Web-application on Django and Windows Forms application on C#. The task is to organise communication between this two applications. C# application need to get some data from server and post data to server (server is djan

sorl-thumbnail: upscale won't wok

2011-06-05 Thread Eugene Goldberg
Hello! I'm trying to create a thumbnail using sorl-thumbnail in Django template: source: {{ photo.image.width }} x {{ photo.image.height }} {% thumbnail photo.image "1024x1024" upscale="False" as photo_thumbnail %} thumbnail: {{ photo_thumbnail.width }} x {{ photo_thumbnail.height }} {% en

How to cache model field?

2011-05-10 Thread Eugene Goldberg
For example, we have object 'book' and 'vote'. Each vote is assigned to some book. On page I'd like to know how many votes was for certain book? The first solution was to create a methdon in book model: def get_votes(self): .. database query here . return an integer... That is the best w