django

Django CharField limitations

Hi, how can I specify a blacklist for a CharField. However I want the blacklist to be effective in the Django admin panel aswell...otherwise I would just validate it in the view. By blacklist I mean values that can't be used. I also set unique for the value but I would like to disable a few strings aswell. Thanks, Max ...

Django Forms With foreign key

Hi, I have 2 models in django, and im also using ModelForm, my question is the second model have a froreignkey of the 1, and i want to have one page when generating the form. It's possible, how to link the two forms in one page. Class Event(models.Model): id = models.AutoField(primary_key=True) name = models.CharField() class Date(...

best way to deal with JSON in django

I am getting a JSON feed from a server and today I convert it to python object and thus to django view. We are now making an update of our site. whereby the browser client should parse json using jQuery also we will have a adobe-air app which will consume JSON directly However I am not so keen on exposing my back-end server directly...

Writing a Template Tag in Django

I'm trying to customise a CMS written in Django. The content editors aren't flexible enough so I'm trying to come up with a better solution. Without over-explaining it, I'd like it to be a bit like django-better-chunks or django-flatblocks. You set up an editable region entirely from within the template. I want to bind these editable re...

Check if an element exists

I'm trying to find out if an Element in a Django model exists. I think that should be very easy to do, but couldn't find any elegant way in the Making queries section of the Django documentation. The problem I have is that I've thousands of screenshots in a directory and need to check if they are in the database that is supposed to stor...

Django and File Permissions: Best Practices?

I am integrating "legacy" code with Django, and have problems when the process executing Django must write to legacy code directories where it lacks write permissions. (The legacy code is a Python backend to a Tkinter GUI, which I'm repurposing to a browser-based UI.) I could: Make the legacy directory writeable to all, but this seem...

Sorting a list of dictionaries of objects by dictionary values

This is related to the various other questions about sorting values of dictionaries that I have read here, but I have not found the answer. I'm a newbie and maybe I just didn't see the answer as it concerns my problem. I have this function, which I'm using as a Django custom filter to sort results from a list of dictionaries. Actually, ...

get request data in Django form

Is it possible to get request.user data in a form class? I want to clean an email address to make sure that it's unique, but if it's the current users email address then it should pass. This is what I currently have which works great for creating new users, but if I want to edit a user I run into the problem of their email not validati...

Django and related_name

Hi guys, first im so sorry with my english, im new with Django, im from php + codeigniter. I have a problem with a related_name, the tables are fine, but the problem is that in the Select (DropDown) the data display is "bad", in this way: Tarifas_object: Html code: <option value="1">Tarifas object</option> how ill display the correc...

Can you Make a Django form set validate the initial data?

Here's an example: from django import forms class ArticleForm(forms.Form): title = forms.CharField() pub_date = forms.DateField() from django.forms.formsets import formset_factory ArticleFormSet = formset_factory(ArticleForm) formset = ArticleFormSet(initial=my_data) So 'my_data' in the example is the data I want to form t...

can't see records inserted by django test case

I'm trying to provide integration to my django application from subversion through the post commit hook. I have a django test case (a subclass of unittest.TestCase) that (a) inserts a couple of records into a table, (b) spawns an svn commit, (c) svn commit runs a hook that uses my django model to look up info. I'm using an sqlite3 db. ...

Error in Django running on Apache/mod_wsgi

Recently i asked a question regarding an error in apache/mod_wsgi recognizing the python script directory. The community kindly answered the question resulting in a successful installation. Now I have a different error, the server daemon (well, technically is a windows service, I say tomato you say...) doesn't find any of the models, her...

Django equivalent of New Relic RPM for Rails?

Does Django have anything equivalent to the New Relic RPM performance monitoring app for Rails (http://www.newrelic.com/)? Looking to do an app in Django, but would really like to be able to use something like New Relic for monitoring performance. ...

Django and fcgi - logging question

I have a site running in Django. Frontend is lighttpd and is using fcgi to host django. I start my fcgi processes as follows: python2.6 /<snip>/manage.py runfcgi maxrequests=10 host=127.0.0.1 port=8000 pidfile=django.pid For logging, I have a RotatingFileHandler defined as follows: file_handler = RotatingFileHandler(filename, maxByt...

NoReverseMatch Exception help in Django

Hi--I'm fairly new to python and following along with part 4 of the tutorial for the Django framework here. I'm trying to implement generic views for the polls app--my code seems correct (as far as I can tell), but when I try to vote, I get a NoReverseMatch Exception that states: Reverse for 'polls/poll_results' with arguments '(1L,...

Django ORM: time zone support

Hi, Can you recommend any implementation of Time Zones support for Django's ORM (DateTime filed)? Ideally it has to be DB-agnostic and transparent, allowing to use all standard ORM things like __lt, __gt etc. I guess it needs to store time in UTC plus local timezone. Thanks! ...

Filter by property

Is it possible to filter by property? i have a method in my model: @property def myproperty(self): [..] and now i want to filter by this property like: MyModel.objects.filter(myproperty=[..]) is this somehow possible? ...

how to handle an event on Django event Calendar

Hi, Is there a way to have a django Clandar Event, i have a Event model, and i want to display the event information on the calendar in order to know if the organiser is free or busy on the date event. Many Thanks. I didn't find the Django Calendar. Where can i find some good example please ? Many thanks ...

Django - Repeating a form field n times in one form.

I have a Django form with several fields in it one of which needs to be repeated n times (where n is not known at design time) how would I go about coding this (if it is possible at all)? e.g. instead of :- Class PaymentsForm(forms.form): invoice = forms.CharField(widget=ValueHiddenInput()) total = forms.CharField(widget=ValueH...

Django custom template tags and template loaders

[I have this discussion at http://groups.google.com/group/django-users/browse_thread/thread/989c569d5118980d] Is 'django.template.loaders.app_directories.load_template_source' required in the TEMPLATE_LOADERS setting for custom template tags to work? We know that simply having a custom tag in the templatetags directory of your Django ...