django

Display form in Django not based on Models/Form

My view calls some backend classes which need some user input. When user input is required, i halt processing and store the questions into the session - request.session['questions']. request.session['questions'] is a list of dictionaries. e.g. request.session['question'] = [] request.session['question'].append({'question' : 'Whats your ...

Dajaxice Autodiscover in Django App (cannot import name dajaxice_autodiscover)

Hi, I was following the directions at http://wiki.github.com/jorgebastida/django-dajaxice/installation to install Dajaxice for simple AJAX support and I ran into an error I can't quite figure out. The lines: from dajaxice.core import dajaxice_autodiscover #dajaxice_autodiscover() in urls.py seem to be causing an error (cannot import...

django app fields - copy and paste data

what field in the django models class should be used if the type of data (text/images/html) is unknown? i'm looking for a field that can handle copy and pasted html code, images, text, etc. ...

django display m2m elements in a template

if a have a declaration like def inside_classroom(request,classname): theclass = Classroom.objects.get(classname = classname) members = theclass.members.all() c = Courses.objects.filter(classroom = theclass) return render_to_response('classroom/inside_classroom.html', { 'theclass': theclass, 'c':c, 'members':mem...

Django: How can I add weight/ordering to a many to many relationship?

I'm having Pages with TextBlocks on them. Text Blocks may appear on different pages, pages may have several text blocks on them. Every page may have these blocks in an ordering of it's own. This can be solved by using a separate through parameter. Like so: class TextBlock(models.Model): title = models.CharField(max_length=255) ...

Does Python Django support custom SQL and denormalized databases with no Foreign Key relationships?

I've just started learning Python Django and have a lot of experience building high traffic websites using PHP and MySQL. What worries me so far is Python's overly optimistic approach that you will never need to write custom SQL and that it automatically creates all these Foreign Key relationships in your database. The one thing I've lea...

Extending Django Flatpages to accept template tags

I use django flatpages for a lot of content on our site, I'd like to extend it to accept django template tags in the content as well. I found this snippet but after much larking about I couldn't get it to work. Am I correct in assuming that you would need too "subclass" the django flatpages app to get this to work? Is this best way of d...

extend base.html problem

I'm getting the following error: Template error In template /home/mo/python/django/templates/yoga/index.html, error at line 1 Caught TemplateDoesNotExist while rendering: base.html 1 {% extends "base.html" %} 2 3 {% block main %} 4 <p>{{ page.title }}</p> 5 <p>{{ page.info}}</p> 6 <a href="method/">Method</a> 7 {% endblock...

Django - Can you use property as the field in an aggregation function?

I know the short answer because I tried it. Is there any way to accomplish this though (even if only on account of a hack)? class Ticket(models.Model): account = modelfields.AccountField() uuid = models.CharField(max_length=36, unique=True) created = models.DateTimeField(auto_now_add=True) class Meta: ordering =...

PicklingError: Can't pickle suds.sudsobject.User: attribute lookup suds.sudsobject.User failed

Hi.. I have a django application... I am accessing the web service using the SOAP suds client... I need to create a user object from the entries entered in the GUI... This user object is to be passed to a method... But i get the following error: PicklingError: Can't pickle suds.sudsobject.User: attribute lookup suds.sudsobject.User fai...

Django DateField without year

Is it possible to have a DateField without they year? Or will I have to use a CharField? I am using the admin to edit the models. ...

Wrong sessionID being used in callback, but only on one particular computer

I am writing a Python/Django web application that uses OAuth (for the TwitterAPI, not that it should matter). I am storing a session ID in my login function, and then after using OAuth to get the user's token, I try to retrieve the sessionID in my callback function. The callback function then always fails(throws an exception) because i...

Display image in Django Form

I need to display an image in a Django form. My Django form is quite simple - a single text input field. When I initialise my Django form in a view, I would like to pass the image path as a parameter, and the form when rendered in the template displays the image. Is is possible with Django forms or would i have to display the image separ...

Permission to view, but not to change! - Django

Hi folks, is it possible to give users the permission to view, but not to change or delete. currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there. I really need this as some users will only be able to consult the admin panel, in order to see what has been added in. Help wou...

Easy comparing MySQL plans in Django

Hi, is there a way to print out MySQL query for example from this line of code Model.objects.all().order_by(sort_headers.get_order_by()) I want to plan best way of using Django but with > 1 million of objects in my model this is getting too slow. Thanks ...

Some kind of event functionality in Django?

I have a view my Django application which when invoked calls my backend. My backend logic sometimes reaches a point when it needs user input to continue. When this happens, I pickle dump my backend data into the session so that i can resume it later on. Currently i have defined the scenario when user input is required as a custom except...

Django admin default filter

I know I already managed to do this but can't remember how nor I can't find any documentation about this.. How can apply a filter by default on a object list view in the admin ? I have an app which list quotes and those quotes have a status (ex: accepted, rejected, on hold ..). I want the filter set on status='accepted' by default tha...

Red hat enterprise 5 Linux with Python 2.5

Hi, I have to deploy a Django project on Red hat enterprise linux 5, the project has been developed on Python 2.5 but the server environment has Python 2.4 which is causing some issues. I googled a lot over internet to get the Python 2.5 built rpm for the server but there are only src rpm available for the mentioned Linux version. I h...

How to store an integer leaded by zeros in django

Hello, I'm trying to store a number in django that looks like this: 000001 My problem is that if I type this inside an IntegerField it gets converted to "1" without the leading zeros. I've tried also with a DecimalField with the same result. How can I store the leading zeros whithout using a CharField? (I need to manipulate that numb...

Django query filter a set of data

if a have a query like following = Relations.objects.filter(initiated_by = request.user) in which i'm having all the users followed by the currently logged in user, and i want to display those user's blog posts. Using a query like: blog = New.objects.filter(created_by = following) it only shows me the blog posts of the use...