I followed along this tutorial for django's RSS and ATOM feeds and I got it to work.
However the test development server keeps making the browser download the feeds as a file instead of the browser detecting it as an xml document.
My experience with HTTP tells me that there is a missing mime type in the Content-Type header.
How do I ...
I recently started experimenting with Python decorators (and higher-order functions) because it looked like they might make my Django unit tests more concise. e.g., instead of writing:
def visit1():
login()
do_stuff()
logout()
I could instead do
@handle_login
def visit1():
do_stuff()
However, after some experimentin...
When building a Django project its common to use many pre-built apps. For example, for tinymce or open-id.
It would be nice to keep these separated from project-specific apps.
My idea would be to create an "addons" directory/module in the project.
It should then be possible to use:
from addons.tinymce import models
However, tinymce...
I am trying to implement a djapian based full text search for searching user
profiles in my django site. I basically followed the following steps to build the
indexes:
Updated the model Profile to add the djapian indexer.
Ran python manage.py index --rebuild to rebuild the indexes.
However when I try to search using the Profile ...
Not that level of failure indeed. I just completed the 4 part tutorial from djangoproject.com, my administration app works fine and my entry point url (/polls/) works well, with the exception that I get this http response:
No polls are available.
Even if the database has one registry. Entering with the admin app, the entry shows up th...
How do i assign initial values to fields inside a ModelForm. eg.
class Form1(forms.Form):
title=forms.CharField(initial="hello")
what will be the equivalent for this using modelForm whose basic syntax is something like:
class Form2(djangoforms.ModelForm)
class Meta:
model=SomeModel
fields=('title')
What I am tryi...
Hi I've been working with django for some months and find it really helpful, is there alike frameworks for other programming languages such as java or c#?
The problem I suffer by using django is finding a server to host the proyect because supporting servers are more expensive and harder to find.
From django I find useful: the object-re...
I'm using google app engine with django 1.0.2 (and the django-helper) and wonder how people go about doing recursive delete.
Suppose you have a model that's something like this:
class Top(BaseModel):
pass
class Bottom(BaseModel):
daddy = db.ReferenceProperty(Top)
Now, when I delete an object of type 'Top', I want all the ass...
Hi
At the minute, I'm using Django's object_list to handle pagination. I'm happy to move to the proper Paginator() class if you think I need it after you hear my problem:
On the homepage, I want to paginate by 7, but on all other pages I want to paginate by 10.
How would I go about doing this? I really can't get my head around it. The...
Hi!
I am writing small social application. One of the features is to write user name in the header of the site. So for example if I am logged in and my name is Oleg (username), then I should see:
Hello, Oleg | Click to edit profile
Otherwise I should see something like:
Hello Please sign-up or join
What I want is to show thi...
In a Django ModelForm, you can change the widget type of a field like so:
class EntryForm(ModelForm):
entity = forms.CharField()
class Meta:
model = Entry
I can easily create a modelformset from the same model like so:
EntryFormSet = modelformset_factory(Entry)
But is there a way to include the input field type ch...
Possible Duplicate:
Rails or Django? (or something else?)
These are two web frameworks that are becoming (or have been in many circles) popular. I was wondering what are the advantages and disadvantages of each? Feel free to comment on Ruby and Python pros and cons also.
Two disadvantages I am speculative about for RoR is the s...
What is the right way to create custom pgsql types for django application so that each time database is created with syncdb, all custom types are created prior to creating any tables (so that tables can use this type)?
I also use django-evolution, but that's not an appropriate solution — it runs after syncdb. I can imagine doing a worka...
I have been working on a django app on my local computer for some time now and i am trying to move it to a mediatemple container and im having a problem when i try to start up django. it gives me this traceback:
application failed to start, starting manage.py fastcgi failed:Traceback
(most recent call last): File "manage.py", line 11, i...
Should entry_set be cached with select_related? My DB is still getting calls even after I use select_related. The pertinent sections
class Alias(models.Model):
achievements = models.ManyToManyField('Achievement', through='Achiever')
def points(self) :
points = 0
for a in self.achiever_set.all() :
po...
In my model, I have 2 datetime properties:
start_date
end_date
I would like to count the end date as a one week
after the start_date.
How can I accomplish this?
...
I have a Django app that gets it's data completely from an external source (queried via HTTP). That is, I don't have the option for a local database. Session data is stored in the cache (on my development server I use a SQLite database, so that is no error source). I'm using bleeding edge Django 1.1svn.
Enter the problem: I want to use ...
I am trying to request.user for a form's clean method, but how can I access the request object? Can I modify the clean method to allow variables input?
Thanks.
...
I wish to update a model instance from a form I have.
The form is a ModelForm, so it has the same attributes as the model instance, how do I transfer the attributes from the form instance to the model instance instead of doing this:
modelinstance.name = form.name
.
.
.
.
A for loop perhaps? :)
Thanks!
...
I have a handful of records that I would like to sort based on a computed value. Got the answer over here... like so:
sorted (Profile.objects.all (), key = lambda p: p.reputation)
on a Profile class like this:
class Profile(models.Model):
...
@property
def reputation(self):
...
Unfortunately the generic view i...