Hi, I'm trying to display a form on a template, but I get a fantastic error :
Caught AttributeError while rendering: 'WSGIRequest' object has no attribute 'get'
The error is in this line : {% for field in form.visible_fields %}
My view :
def view_discussion(request, discussion_id):
discussion = get_object_or_404(Discussion, id=d...
I have this swf (flash) file that provides the json that needs to be sent to the server.
I wrote a very simple jQuery:
function submitForm(swf_json) {
$('#swfjson').val(swf_json); #swfjson is an input of type hidden
$('#titleForm').submit();
}
and the swf will call the submitForm above and I receive the request.POST in django as usua...
Hello everyone,
My database has two types of entries: The very dynamic (users, comments, etc) and the more static (email templates, flat-pages).
During testing I want a clean DB but with the real 'semi-static' data.
Is there a way to make Django's testing system to load parts of the original DB ?
Thanks
...
I just finished the Django tutorial and started work on my own project, however, I seem to have missed something completely. I wanted to get a random slogan from this model:
from django.db import models
class Slogan(models.Model):
slogan = models.CharField(max_length=200)
And return it in this view:
from django.http import H...
I have the following Django models:
class Foo(models.Model):
title = models.CharField(_(u'Title'), max_length=600)
class Bar(models.Model):
foo = models.ForeignKey(Foo)
eg_id = models.PositiveIntegerField(_(u'Example ID'), default=0)
I wish to return a list of Foo objects which have a reverse relationship with Bar objects...
Hello!
I'm running Django 1.2 beta and trying out the new feature: message framework.
http://docs.djangoproject.com/en/dev/ref/contrib/messages/
Everything seems to work, but when I try to output the messages, I get nothing. Seems that messages variable is empty. I double checked all the settings, they seem to be just like in the manu...
My model looks like this:
class Staff(models.Model):
StaffNumber = models.CharField(max_length=20,primary_key=True)
NameFirst = models.CharField(max_length=30,blank=True,null=True)
NameLast = models.CharField(max_length=30)
SchoolID = models.CharField(max_length=10,blank=True,null=True)
AutocompleteName = models.Char...
Hi,
I would like to create a configuration panel for the homepage of the web-app I'm designing with Django.
This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on.
Basically I don't need an app with different rows, but just a panel page with some configuration op...
I have an object Task and a form that saves it. I want to automatically asign created_by field to the currently logged in user. So, my view is this:
def new_task(request, task_id=None):
message = None
if task_id is not None:
task = Task.objects.get(pk=task_id)
message = 'TaskOK'
submit = 'Update'
el...
When i attempt to add a file with russian symbols in name to the model instance through default instance.file_field.save method, i get an UnicodeDecodeError (ascii decoding error, not in range (128) from the storage backend (stacktrace ended on os.exist). If i write this file through default python file open/write all goes right. All fil...
I have 2 models:
class A(Model):
#Some Fields
objects = ClassAManager()
class B(A):
#Some B-specific fields
I would expect B.objects to give me access to an instance of ClassAManager, but this is not the case....
>>> A.objects
<app.managers.ClassAManager object at 0x103f8f290>
>>> B.objects
<django.db.models.manager.Mana...
Hi,
I'd like to validate user input with regular expression in Django Admin CharField... How is it possible?
Thanks in advance,
Etam.
...
I have a model form that contains a DecimalField() with max_digits set to 5. How do I display this field this way:
<input type"text" size="5" maxlength="5" />
...
I'm trying to send email with some images attached in django. Code used is this snippet : http://www.djangosnippets.org/snippets/1063/. Dunno why the attachment part returns me a core error.
THe code. forms.py
from django import forms
from common import slugify_unique
from django.conf import settings
from django.core.cache import cache...
I have the following abstract Django models:
class Food(models.Model):
name = models.CharField(max_length=100)
class Meta:
abstract = True
In one of my view, I created a bunch of Food model:
panino = Food(name='Panino')
poutine = Food(name='Poutine')
food = [panino, poutine]
From the above, I'm not saving the mode...
Hi folks,
I'm thinking of adding a reputation system to a web application, the site is already being used so I'm trying to be careful about my choices.
I'm developing in Django/Python, thought this would be important.
Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system.
I know there a...
I have a list of books titles:
"The Hobbit: 70th Anniversary Edition"
"The Hobbit"
"The Hobbit (Illustrated/Collector Edition)[There and Back Again]"
"The Hobbit: or, There and Back Again"
"The Hobbit: Gift Pack"
and so on...
I thought that if I normalised the titles somehow, it would be easier to implement an automated way to kno...
Hi, I have some sort of a design problem with my Django AJAX application.
I have a template where I initialize js variable from django context variable like so:
var test = "{{ test }}";
This variable is than used in a number of js functions that are needed for interface to work properly.
So now I'm trying to reuse some content from ...
Is there a project that can log errors in requests to Django on Google App Engine to the datastore (like django-db-log or django.crashlog)?
Thanks!
...
Hello folks. I've been getting lots of answers from stackoverflow now that I'm in Django just by searching. Now I hope my question will also create some value for everybody.
In choosing Django, I was hoping there was some similar mechanism to the way you can do partials in ROR. This was going to help me in two ways. One was in gener...