django

Django adminsite customize search_fields query

Howdy! In the django admin you can set the search_fields for the ModelAdmin to be able to search over the properties given there. My model class has a property that is not a real model property, means it is not within the database table. The property relates to another database table that is not tied to the current model through relatio...

In Django-pagination Paginate does not working...

Hello. Python 2.6.2 django-pagination 1.0.5 Question: How to force pagination work correctly? The problem is that {% paginate %} does not work, but other {% load pagination_tags %} and {% autopaginate object_list 10 %} works! Error message appeared, when I add {% paginate %} into html page: TemplateSyntaxError at /logging Caught an...

Automark model names/attributes for translation

Is there any way one could automatically mark all model names and attributes for translation, without specifying verbose_name/_plural on each one of them? Doesn't feel very DRY to do this every time: class Profile(models.Model): length = models.IntegerField(_('length')) weight = models.IntegerField(_('weight')) favorite_mov...

Django logging in and out - doesn't work if prepend_www set

I'm a Django beginner. My site - let's call it abc.com - works fine, letting users log in and out (having originally registered via Django registratiaon). If it's relevant, my virtuahosts file has ServerName abc.com and ServerAlias www.abc.com directives. I don't want my visitors to sense that both abc.com and www.abc.com exist, and s...

Django Template Inheritance -- Missing Images?

Howdy, I have got the following file heirarchy: project   other stuff   templates       images           images for site       app1           templates for app1       registration           login template       base.html (base for entire site)       style.css (for base.html) In the login template, I am extending 'base.html.' 'base.htm...

Django-modpython deploying project

Hi All, I am deploying a Django project on apache server with mod_python in linux. I have created a directory structure like: /var/www/html/django/demoInstall where demoInstall is my project. In the httpd.conf I have put the following code. <Location "/django/demoInstall"> SetHandler python-program PythonHandler django.core.han...

Reverse relationships and distinct querysets.

I have the following models and I'm trying to work out how to do backward relationships. I want a distinct CostRate queryset showing which costrates are associated with a particular SalesEvent. The CostFixedList has all the sales that occurred on the different days. So I'd filter the CostFixedList for a particular SalesEvent, create ...

Django apache-wsgi configuration problem

Hi, I am trying to get my Django project running on the production server. I setup the environment using pip, so it is identical to the development environment where everything is running fine. The only difference is that I don't use virtualenv on production, because this project is the only one that is going to run on production. Als...

Complex relationships with filtering

I'm stuggling to get to grips with relationships in ORM. I want to get a distinct CostItem queryset related to a particular event. Normally I'd filter CostFixedList for the particular event I'm interested and get a the Cost_Rate id's. From that I could then get the CostItem id's. I could do this easily in SQL, but can't understand ...

django m2m how can i get m2m table elements in a view

i have a model using m2m feature: class Classroom(models.Model): user = models.ForeignKey(User, related_name = 'classroom_creator') classname = models.CharField(max_length=140, unique = True) date = models.DateTimeField(auto_now=True) open_class = models.BooleanField(default=True) members = models.ManyToManyFiel...

Django: auto minifying css/js files before release

Hi, I have following case: I want to use uncompressed js/css files during development (to debug js for example) but on production I want to switch automatically to minified versions of that files. some simple solution is to put in your template: <script src="some_js.{% if not debug %}min.{% endif %}js".... but this require manully p...

How to add a second changelist_view to a django model

The changelist_view is great for editing certain fields for many entries, so I thought about adding multiple views to my admin interface, each for different fields but I'm not really sure what would be the best way... did anybody do that before ? ...

does django have a memory based cache or do you have to use memcache?

can I store objects in the servers memory to cache data using django, or do I have to use memcache for that? ...

creating events in my classes, and allowing others to hook into them in my django app

I want to create events for my classes. Say I create a CMS application that has a Article object. I create events like: OnEdit OnCreate OnDelete PreCreate PreDelete Now I want someone to be able to hook into these events, and add their custom functionality at each event they wish. I don't want them touching the core source code, so...

django: How to make one form from multiple models containing foreignkeys

I am trying to make a form on one page that uses multiple models. The models reference each other. I am having trouble getting the form to validate because I cant figure out how to get the id of two of the models used in the form into the form to validate it. I used a hidden key in the template but I cant figure out how to make it work i...

how to display fixed dropdown in django admin?

Hi all, I would like to display priority information in a drop down. Currently i am using a integer field to store the priority, but i would like to display high/medium/low instead of letting user type in a priority. A way to approximate this is to use a Priority database which stores 3 elements, 1:high, 2:medium, 3:low, but it seems ...

django-haystack more_like_this returns nothing

I've installed the haystack app and I'm using the solr backend. Search works perfectly although when I try to use the more_like_this template tag, nothing is returned. I have added <requestHandler name="/mlt" class="solr.MoreLikeThisHandler" /> to solrconfig.xml and I can make queries at http://127.0.0.1:8080/solr/mlt The template is f...

how to limit the foreignkey dropdown with constraints?

Hi all, I have a database which keeps track of interaction between two different teams (represented in the admin interface by two different groups). For some fields, i have a foreignkey to Users database, and i would like to limit the dropdown people to only the specific groups. If anyone have any suggestions, it would be much appreci...

modify the add new link for foreignkey stackedinline

Hi all, Currently if i have a table that refer to another table, and in the admin form of the second table, there is a little button to add new items to the dropdown. The current behavior is to popup a new window, but i would like to popup something like a lighttable on top of current page. Would there be an easy way of modifying the g...

How do I write my own Django model update signal?

I'm currently using a the pre_save django signals and it works fine when calling the save method on a model. How do I write an update signal to a model? Django doesn't seem to have an update signal built-in. ...