Hi,
I have setup a apache2 mod_python environment with stackless python and it is working.
And When I test the python environment with sys.version , it shows
2.5.2 Stackless 3.1b3 060516 (python-2.52:76701, Dec 8 2009, 02:13:34)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)]
in the browser
But when I do "import stackless" it shows :
MOD_PY...
The full text of the error is:
TemplateSyntaxError at /
Caught an exception while rendering:
current transaction is aborted,
commands ignored until end of
transaction block
I've recently reinstalled all the software on my computer. The code used to work no problem before. It also still works no problem on a friend's comp...
I have a GET form with checkboxes. When i select several boxes and submit the form it produces a link with several variables with the same name. How do i get each value of those variables in the view?
class SearchJobForm(ModelForm):
query = forms.CharField()
types = forms.ModelChoiceField(queryset=JobType.objects.all(), widge...
How do i remove the default --------- choice from ModelChoiceField?
...
I have a catalog of items like so:
class Items(models.Model):
name=models.CharField()
type=models.ForeignKey(ItemType)
quantity=models.IntegerField()
price=models.DecimalField() # Simplified
[... other fields]
and it has some attributes governed by:
class ItemAttributes(models.Model):
name=models.CharField()
...
Form:
class SearchJobForm(forms.Form):
query = forms.CharField()
types = forms.ModelChoiceField(queryset=JobType.objects.all(), widget=forms.CheckboxSelectMultiple())
View
def jobs_page(request):
if 'query' in request.GET:
form = SearchJobForm(request.GET)
else:
form = SearchJobForm()
variables = RequestContext(req...
I am working on a Django application where I need all the postgres represented datetime fields to be saved in UTC (as they should). When I'm creating models with DateTime fields they database representation is generated as "timestamp with time zone".
Although I can manually alter the tables to remove the timezone from the fields, I was ...
For the following code:
class Image(models.Model):
alt_name = models.CharField(max_length=200)
url = models.CharField(max_length=255, blank=True)
class Button(Image):
source = models.ImageField(max_length=1024, upload_to='buttons')
class Snapshot(Image):
source = models.ImageField(max_length=1024, upload_to='snapshots')
c...
CREATE TABLE `django_comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content_type_id` int(11) NOT NULL,
`object_pk` longtext NOT NULL,
`site_id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`user_name` varchar(50) NOT NULL,
`user_email` varchar(75) NOT NULL,
`user_url` varchar(200) NOT NULL,
`comment` longtext N...
Hello everyone,
My Django app started breaking all of a sudden and I cannot understand why. I can't even get it to run now. I'm running revision 11798.
When I use the stand-alone server to test my app, it suddenly started not importing csrf. I previously had it working perfectly. I tried to see what was up by using the shell and here ...
Debugging Django on Dreamhost is proving quite the challenge. To my knowledge, print statements aren't available, and neither are logs... any suggestions?
...
How can I access the model instance from a custom Django model field's to_python call?
When I overrode pre_save, for example, I had model_instance as one of the arguments.
to_python only receives the value.
How can I do something like:
def to_python(self, value):
value = value_based_on_another_field_from_model()
return value
...
Hello everyone,
I am attempting to validate a form (and it used to work before). For some reason, I can't seem to get the various cleaning functions such as clean_username(self) to get called when form.is_valid() is called.
I know there are not nearly enough checks yet (they are under construction you see ;-) ), but here are my classe...
I run my google app engine application in one of two ways...
Directly by using the application from http://localhost:8080
Or execute unit tests from http://localhost:8080/test
When I create entities by using the application directly, the data is visible in the Development Console (dataStore view).
However, when I execute the unit te...
filefield works just fine in the admin, but in a template nothing is uploaded upon submit. the form comes back with a "required" error for the filefield.
the paths seem to be right, and if they weren't, I don't think filefield would be working in the admin.
spent hours on this and I'm stumped. I'm using trunk. Ideas?
...
I'm using the django_openid_auth module and have it configured to automatically create new user accounts for new OpenIDs. This makes the "sign up" process really trivial, but I'm a bit worried that because of the way that Google generates it's OpenID tokens it might accidentally create a new account for an existing user, giving them the...
My current Django setup uses MySQL as the main database to store models. Now for my project I need to connect to a remote PostgreSQL database and retrieve data from it. Is it possible to do this by using built-in Django and Python features or I will need to use library such as Psycopg2?
It would be great for me, if I will be able to use...
In Django, I need to create a model in which an instance of that model can inherit values from another instance of that model in what amounts to a superclass-subclass type relationship. I created a field in this model called parent, which is an optional self-referencing foreign key. I then want to override the __getattribute__ method a...
Hi,
I have a filter that I use for lang support in my webapp. But when I publish it to gae it keeps telling me that it the usage of CPU is to high.
I think I located the problem to my filters I use for support. I use this in my templates:
<h1>{{ "collection.header"|translate:lang }}</h1>
The filter code looks like this:
import re
...
Hi,
Can any one point me to code where users can change their own passwords in Django?
Thanks.
...