django

the django template and combine {{ }}

Hello, I start with django, and I have a little problem. Well, I have a tuple (top) and I wanted to display an element of it according to another template value (date, which is a datetime type). So, I did that : {{top.date.day}} Well it doesn't work, so I tried it : {{ top.{{date.day}} }} And it didn't work neither. So what is...

django generate a feed for a particular tag

I want to generate a feed of latest entries of a blog post under a particular tag. I used django-tagging. How can i do this? Here is how i defined my LatestEntriesFeed from django.core.exceptions import ObjectDoesNotExist from django.utils.feedgenerator import Atom1Feed from django.contrib.sites.models import Site from django.contrib.sy...

django - Dynamically add computed column to queryset

I have a database table containing 4 integer columns representing version information - Major, Minor, Cust, Rev. I'd like to represent these as a single column in my form, with relevant padding. So: 0, 1, 2, 3 = [0.01.002.0003]. I realise that there are several ways to use SQL to do this, but I'm curious as to whether it's possible to ...

Just installed django-tinymce but the HTMLField is not showing up in the admin view

I used pip to install it, and followed the usage directions found here: http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/usage.html under the section "The HTMLField model field type". I re-synced the db (not even sure that was needed), restarted apache2, and yet the text field is still just a textarea. Any sugg...

Weird subprocess issue with Django

Hello! I'm sorry if this is a duplicate question, but after searching through 3 pages for "django subprocess", I, for one, could not find the answer to my particular problem. I'm trying to run pdflatex on tex file, but for some reason in Django it doesn't produce anything. It works just fine in a regular python script, though. I've om...

Available Django apps listing?

I'm learning django and I love the ease of plugging in a 3rd party app (like django-registration). Is there a site listing available 3rd party Django apps? I know I can search google code, github or bitbucket, but is there a more organized, django-specific resource out there? Maybe with reviews or ratings? ...

How to make case insensitive filter queries with Google App Engine?

Hi All, I am working on a GAE Django Project where I have to implementing the search functionality, I have written a query and it fetches the data according to the search keyword. portfolio = Portfolio.all().filter('full_name >=',key).filter('full_name <',unicode(key) + u'\ufffd') The issue with this query is, that it is case sensiti...

How can I embed django csrf token straight into HTML?

Hi, within my django app I am storing strings of html in the db that will then be displayed on the users' home pages as "messages". Some of these messages contain forms, but not being written in the template language, I am not able to insert the csrf token (thus breaking the app). Is there a way to insert this token directly from wit...

Audio waveform visualisation in Python/Django

I've looked around Stack Overflow for an answer to this, but nowhere seems to give the correct answer or direction... My project will allow a user to upload a WAV, which ultimately will be converted to a low quality MP3 using FFmpeg on the server and it'll all be stored and served on Amazon S3. The next obstacle is working out how to ex...

Novel tree storage? Django recursive import with XLRD

My data (spreadsheet): '1',,, ,'1.1',, ,,'1.1.1', ,,'1.1.2', ,,'1.1.3', ,'1.2',, ,'1.3',, ,,'1.3.1', ,,'1.3.2', ,,'1.3.3', '2',,, ,'2.1',, ,,'2.1.1', ,,,'2.1.1.1' ,,,'2.1.1.2' ,,,'2.1.1.3' My model: class Vocabulary(models.Model): name = CharField(max_length=60) class Concept(models.Model): parent = ForeignKey('self', blank=...

How do you aggregate a query based on a boolean field?

I have this Article model for a news site with a boolean field called "sticky". The idea is that when the author writes an article and marks it as sticky it should always stay at the top of the list of articles. I wrote a template tag and here's my render method: def render(self, context): context[self.varname] = self.model._default...

How do I access auth User's User.objects.create_user(...) in a south migration?

Instead of using django's auth module I've used my own and already regret it a lot. In an effort to rectify the situation, I'm trying to migrate the data from my User model to django.auth.models.User. I've created a data migration as follows: def forwards(self, orm): """Migrate user information from mooi User model to auth User mo...

Django mod_wsgi PicklingError while saving object

Do you know any solution to this: [Thu Jul 08 19:15:38 2010] [error] [client 79.162.31.162] mod_wsgi (pid=3072): Exception occurred processing WSGI script '/home/www/shop/django.wsgi'., referer: http://shop.domain.com/accounts/checkout/? [Thu Jul 08 19:15:38 2010] [error] [client 79.162.31.162] Traceback (most recent call last):, refere...

Django: multiple dynamic comboboxes

Hi, does anyone know how to link two comboboxes which are generates from a form in a way that makes the 2nd combobox dependent on the 1st one? Every time the user would change the selection in combobox #1, the options in combobox #2 would change to a predefined list of options. The potential options for both comboboxes are fixed at time...

User permissions Django for serving media

Hey, I want to set up a Django server that allows certain users to access certain media. I'm sure this can't be that hard to do and I'm just being a little bit silly. For example I want USER1 to be able to access JPEG1, JPEG2 and JPEG3 but not JPEG4, and USER2 to be able to access JPEG3 and JPEG 4. [I know I should be burnt with fire ...

How do I access unrelated models within a Django template?

I want to use an app to create a menu that is easy to edit with the admin interface. Something like this: class Menu_item name = models.CharField() item_url = models.URLField() My template looks something like this: {% extends base.html %} div ID="nav" {{ foo.navbar.? }} /div div ID="Content" ...

modwsgi - Precompiled Binaries for Python 2.4?

I'm trying to install Django using Apache and modwsgi on Windows XP. The problem is our whole development environment uses Python 2.4. This page explains how to install modwsgi on Windows but it doesn't link to any precompiled binaries for Python 2.4. Anyone know of anything, or a workaround? ...

django forms into database

hey guys, im trying to make a volunteer form, that takes info such as name, last name, etc. and i want to save that info into my database (MySQL), so that it can be retrieved later on . ...

How does this change affect the speed of this database query?

First i was using this request: Model.object.get(name='somethink', date=somedatavariable) But then I needed to extend my query and change it to this: Model.objects.get(name__icontains="somethink", date__range(start_date,end_date)) Suddenly my database takes 5 times longer than with the original query. What's going on here, and how ...

Django : How to pass context ?

Hi I know about passing the context to templates, but I am bit confused with the given scenario, please help class X: id: name: status: Class Main: number1: object of X number2: object of X message: "Hello World!" I get Object of Main which has two X objects but with different contexts. I want to write one template for X and ...