django

Transferring Django Model Instances through RPC

Suppose I have 2 sites that shares a common Model. What would be the best way to transfer a new Model instance created at Site A and save it in Site B's database? Could you please also recommend APIs for sending and receiving the data? ...

How Can I Store My Images On The Server

How do I store a photo on the server. I store them in a directory - "D:\zjm_code\basic_project\pinax\media\default\pinax\images\upload" but this now a lot of images. Is there another simple way? Thanks ...

Django admins disappearing from the admin index

We're running a Django website with rough 45 install Django admin classes. The handler is mod_fastcgi. Every once in a while about half the admins disappear from /admin/ screen. Touching the production.fcgi file restores everything to normal, but we have yet to determine the underling cause. Any thoughts on what the underlying issue mi...

Django query case-insensitive list match

Hi, I have a list of names that I want to match case insensitive, is there a way to do it without using a loop like below? a = ['name1', 'name2', 'name3'] result = any([Name.objects.filter(name__iexact=name) for name in a]) ...

JSONEncoder and Unicode (Django)

Hey, I am using JSONEncoder with Django and to encode dictionaries containing Unicode strings (JSONEncoder.encode()). Resulting JSON is injected in the web page. The problem I am facing is that the resulting JSON contains u markers next to the strings and thus is not correctly interpreted in java script e.g. { u"key" : u"value" } How ...

Django model translation : store translations in database or use gettext ?

I'm in a django website's I18N process. I've selected two potentially good django-apps : django-modeltranslation wich modifies the db schema to store translations django-dbgettext wich inspect db content to create .po files and uses gettext From your point of view, what are the pros and cons of those two techniques ? ...

django dumpdata hangs

On AWS using Postgres, I do: manage.py dumpdata and the server just hangs. Any suggestions about what I should look for? ...

Django models | get specific columns

Is there a way to filter and get only specific columns ex-: get all entries within the column first_name. ...

Trying to Nullify Django model fields with method where model and fields are parameters

I'm trying to write a method like the below where a list of fields (a subset of all the fields) is passed in as a parameter and has their column values set to null. I would be happy of I could get a method with just the fields as a parameter like below, but having the model as a parameter would be even better. from my_project.my_app.mo...

Django form models | ComboBox value

How do I get the selected value from a form's ComboBox field? what is the model class that deals with ComboBoxes? .. Thanks. ...

Can a django model have embed classes?

Hi, I want to have a django model like this: class Model(models.Model): string = models.CharField() class ContactDetails: phone = models.IntegerField() Is this possible? I've tried googling but it doesn't seem to answer my question This would mean i'd have while accesssing: Model().ContactDetails.phone working like that :) Jo...

django: How to make copy of one of the objects in the db

Hi, I wonder if there is a way to make a copy of one db item? e.g. I have a model class Category(models.Model): slug = models.CharField(max_length=200) name = models.CharField(max_length = 200) So if I added one item, how can i clone it 100 times for testing? ...

How to detect Browser type in Django ?

How can i detect which browser type the client is using. I have a problem where i have to ask people to use different browser (Firefox) instead of IE. How can i get this information. I know http request has this information (Header). How will i get the navigator.appName from the view.py in the Django framework ? ...

Django: QuerySet with objects where one time is earlier than another

I have a Django model TimeThingie with two TimeFields called t1 and t2. How do I get all TimeThingie objects where t1 < t2? ...

Large Django application layout

I am in a team developing a web-based university portal, which will be based on Django. We are still in the exploratory stages, and I am trying to find the best way to lay the project/development environment out. My initial idea is to develop the system as a Django "app", which contains sub-applications to separate out the different par...

Clarification regarding geodjango

I am new to geodjango. I am using a geodjango model for my application. in one of my geodjango model class I am using a location field of type PointField() . I want to store the location for each entry into that model class Table. Could anyone please help me how to insert values into that field, Or could anyone please suggest a referenc...

How to use sessions with django piston auth?

The problem is that I want to store authentication in a cookie that I can present to django piston rather than requiring user/password to be typed in each time (without hardcoding or storing the user/pass combo somewhere on disk). I was hoping to accomplish this with cookies like someone would without the piston API. Am I missing somet...

how do I use html block snippets with dynamic content inside a django template that extends another file?

Hi. Can someone please help me figure out a way to achieve the following (see snippets below) in Django templates? I know that you cannot use more than one extends, but I am new to django and I do not know the proper syntax for something like this. I want to be able to do this so that I can use my nested div layout for css reasons wit...

How can request handlers communicate in Django?

If you make a long-running http request to a Django application, can you send a second request to communicate with it? Can you share data between requests? Pylons has a concept of application globals. Top level variables in node.js are all application globals. How can I do this in Django? ...

Django-subclassed ModelChoiceField Encapsulation

I'm trying to write a Django-subclassed ModelChoiceField class that knows how to load itself, but I'm not having much luck figuring out the pattern required. I don't want form classes that uses my field to have to set anything other than the label and required attributes; that is, I don't want to put duplicate queryset logic in every on...