django

Why is my Django app not displaying dynamic images when the path is correct?

My Django 1.1 app uses dynamic images. I'm confused about why the path generated from my template tag: {{image_product.photo.path}} looks correct, but does not display the requested image. This generates a path that works: src='/media/{{image_product.photo}}' => <img src='/media/lcdtvs/product1.jpg'> This DOES NOT work: src='{{...

mysql encoding problems

I am dealing with some external APIs, and when I save to the db, I am receiving some encoding errors, All the content I am dealing with is in unicode; but the mysql encoding is set ti latin1. It seems to work fine on my local system, but throws error on the server. The only difference between the environments is that the local runs pyth...

Python/Django Model overriding the cleaned data

Hello I am currently working on a django project, in one of my Models I have a file upload and image upload, with the parameters of these two fields both are set to blank=True, however there is a stipulatation with this and it is that field can only be blank if one of the two is not, so for example, if the imagefield is complete then the...

Does anyone have examples of integrating Haystack/Solr with Django?

Note: This question originally applied to Xapian, but due to cross-platform issues and poor understanding of Xapian I (our team) chose Solr instead. I'm looking for snippets, tricks, tips, links, and anything to watch out for (gotchas). My technology stack includes: MySQL 5.1 (Not really pertinent) Red Hat and Windows configurations w...

getting started with django-cms: error on page_submit_row

I am getting started with django-cms and I am facing an exception when I try to edit a page in the admin inteface. A TemplateSyntaxError exception is raised due to the {% page_submit_row %} templatetag. TemplateSyntaxError at /admin/cms/page/1/ Caught an exception while rendering: admin/page_submit_line.html Request Method: GET Req...

How many data fields can I add to a Django model before performance really starts to become a factor?

If I want to create a Django model with 500 data fields, will that be slow? What is the upper limit on a Django model/table backed by MySQL on a powerful modern server? If I have 10,000 data fields will it be slow? At what point would I consider breaking down a really large table into smaller sub-tables? ...

How can I alias one directory to my filesystem and a subdirectory of that to a WSGI file in Apache?

I'm using nginx as a reverse proxy to apache/mod_wsgi and Django. Currently everything is working fine with / aliasing my wsgi file, and /media aliasing my media directory. However, I want to set it up so that /media/foo/bar also aliases my wsgi file such that /media/foo/example.txt will serve example.txt with apache, but /media/foo/bar/...

Django templatetag for rendering a subset of html

I have some html (in this case created via TinyMCE) that I would like to add to a page. However, for security reason, I don't want to just print everything the user has entered. Does anyone know of a templatetag (a filter, preferably) that will allow only a safe subset of html to be rendered? I realize that markdown and others do this....

Complex Queries using GAE datastore

Hi. I am in the early stages of developing a sports statistics website (ultimate frisbee) and would like to know your opinions if Google App Engine is right for me. I am writing it in Python using Django and have been comfortable with standard RDBMS for years but this site is a long term project and I am expecting very large amounts of ...

in django admin, can we have a multiple select based on choices

http://docs.djangoproject.com/en/dev/ref/models/fields/#choices i've read through the documentation and this implies using a database table for dynamic data, however it states choices is meant for static data that doesn't change much, if ever. so what if i want to use choices, but have it select multiple because the data i'm usin...

How to run Django on Windows and cope with Apache not having a daemon mode?

Evolution of this question This started as an attempt to find other recommendations for running Django on Linux, accessing SQL Server via Django-PyODBC, and supporting Unicode as competently as in installations running Django on Windows. After failing to materialize with a good solution for ODBC drivers in Linux that would provide the ...

Django Admin redirects not working ...

I am using the latest checkout of the django trunk - when I am in the admin on the "change" page for an object/item, there is a nice little link that says "view on site". The link points to a url such as: http://example.com:8888/admin/r/22/15/ However, when I click on that link (or enter that link into my browser) I get redirected t...

Django: Recommended placement of template files?

It seems that Django doesn't have a convention on the placement of template files. What would be the most logical, preferred placement? (Since Django stresses the interoperability of apps, I assume that the "best" placement would be somewhere under /app/; maybe /app/templates/?) ...

Making a multi-table inheritance design generic in Django

First of all, some links to pages I've used for reference: A SO question, and the Django docs on generic relations and multi-table inheritance. So far, I have a multi-table inheritance design set up. Objects (e.g: Car, Dog, Computer) can inherit an Item class. I need to be able to retrieve Items from the DB, get the subclass, and do stu...

Adding mini caches to django models

Hi, I'm running into performance issues with Django because of m2m relationships. I have a list of Something objects that all have Something_instance.item_set, so I call Something_instance.item_set.all() many times. I'd like to cache that query into Something_instance so that I don't have to run so many queries. Is this possible? (Thi...

Django login fails for some, not all

http://www.mydeliverylist.com Registration seems to be working just fine, but when users go to login with the completed registration, the webpage redirects to the main page without actually logging in. I've verified that the database is properly updated. However, on a local network (I'm hosting), I can register and log in just fine. ...

In MVC (eg. Django) what's the best place to put you heavy logic?

In MVC architecture lets consider django: I have a method to calculate best employee of the year (1000 lines of code with a complex logic), where should I define it and who will call it? Thanks ...

How do you serve vanilla/custom pages in an MVC based site?

Let's say you've setup your site using Pylons, Django and most of the site runs fine and according to the framework used. However, what if you had a custom section that was entirely say, composed of flat html files and its own set of images, which you didn't have time to actually incorporate using the framework and were forced to basical...

Is there a better way to get ahold of a custom ImageField other than searching through foomodel._meta.fields()?

Calling foomodel.image on a model instance (where image is a custom ImageField) returns the instance of ImageFieldFile, not the ImageField itself. ...

Django-GXT interaction

We are using Django as the back end and GXT 2.1 as the front end. Somehow my GXT application cannot communicate with GXT, without using requests in the form say http://localhost/ and so on. Does any one know about how we can go about it? ...