I think this is easiest to understand as an example:
I have models Image and ImageType, where and image has exactly one type. The parameters in ImageType would regulate image size, thumbnail size, etc., as photo gallery images might display differently from, say, profile pictures.
I want profile images and gallery images to appear as s...
Hello,
I have two Django sites: one for development and one for production. Every once in a while, the data from the development database needs to be transferred to the production database or the other way around. I use postgresql.
This works fine: I empty the tables from the database I want to copy to, I generate sql from the applicab...
Is there a way to add get variables into the url while using permalink?
So www.example.com/1999/news/?filter=entertainment
...
I'm trying to use fabric to deploy a Django project and I get this error when I run hg pull:
[myusername.webfactional.com] run: hg pull
[myusername.webfactional.com] out: remote: Warning: Permanently added the RSA host key for IP address '207.223.240.181' to the list of known hosts.
[myusername.webfactional.com] out: remote: Permission ...
I like the comment box at the top with the posts going in reverse order. Comment rating, highest rated comments, all great features, remaining character count, spam flag.
My question is, is there a open commenting system available for Django that already has these features?
...
I want to develop a site in Django, to have the convenient ORM, and admin, to ease administration.
However, the only hosting option I have is running Django through CGI. Therefore, I would also like to make a "read-only" front end in PHP, which will make the experience "normal" for everyday use (i.e only editing [the database] and authe...
I am trying to use the |date filter and running into some problems. Here is the code that outputs an unformatted way:
{% for the_date in event.date_set.all %}
<p>{{ the_date }}</p>
{% endfor %}
this outputs
<p>2010-10-31</p>
<p>2010-12-01</p>
...etc
When I change the code to
{% for the_date in event.date_set.all %}
<p>{{ the_...
I'm trying to capture the queries which my code submits to the database by examining the contents of django.db.connection.queries. For some reason though, after all the automatically produced setup queries are logged, no further queries are logged from my own code. The following test case demonstrates the behavior.
from django.test im...
Is there a way to add a custom error message to a model field without declaring it in the form as a form field? Is this possible?
I don't want to declare the field again, for example
class MyModel(models.Model):
test = models.URLField(max_length = 200)
class MyForm(forms.ModelForm):
test = forms.URLField(max_length = 200, err...
I have multiple forms in a Django project. I was trying to use the Django provided as_p for form displaying due to its simplicity but client wants the error list below the field. Django's as_p prints it above the field label. I rather not add a field printing loop in every template just for this small change. It seems like the least effi...
Hi,
In my models I want to have an optional field to a foreign key. I tried this:
field = models.ForeignKey(MyModel, null=True, blank=True, default=None)
But i am getting this error:
model.mymodel_id may not be NULL
i am using sqlite
edit: if it can help, here is the exception location:
/usr/lib/python2.6/site-packages/django/d...
I've been searching for an elegant way to represent a multi-select weekday field (Mon, Tues, Wed...) in a Django model. I was initially thinking of going integer field using bitwise math but I am not sure if this would be the way to go.
This would be a mostly-read field. I would want the Queryset method to be something like Entry.object...
I have one search box where users can search for either the movie name or actor. On the search results page I want to show the top hits for both the actor and for the movie name in separate tables. How is this done with Django Haystack over SOLR?
Thanks!
...
Hi,
When using Model class like this:
class MyModel(models.Model):
def __init__(self, *args, **kwargs):
self.myfield = models.Field()
super(MyModel, self).__init__(*args, **kwargs)
It doesn't take into consideration myfield(in the admin form, when saving the object... )
But if i declare like that:
class MyModel(m...
I have this model layout:
class Game(models.Model):
game_time = models.DateTimeField(db_index=True)
home_team = models.ForeignKey(Team, related_name="home_games")
away_team = models.ForeignKey(Team, related_name="away_games")
home_score = models.IntegerField(null=True, blank=True)
away_score = models.IntegerField(nul...
I want to publish to the wall of a Facebook Fan Page, from a python/django web application.
The new Graph API looks nice and simple, so I'd like to use that. Unless there is a much easier way :-) I'm guessing the pyFacebook package would do want I want, but it appears to use the old rest interface. pyFacebook is probably a complete o...
If I wanted to implement some sort of chat tool in my django webapp, implemented with basic ajax polling as opposed to comet, what should I do to secure it, besides running over SSL. Should I just use the permissions app for each chat session and generate a random token to be accessed in my urlconf? Are there better/different approaches ...
Django, What's the best ,fastest way to get only first and last element from something, Customer.objects.xxxx such filter, value_list or ...
...
Hi all, I have an error from the following code. I am sure it is obviuous to someone with more Python experience. This is a snippet from http://djangosnippets.org/snippets/727/
import sys
import cProfile
from cStringIO import StringIO
from django.conf import settings
class ProfilerMiddleware(object):
def process_view(self, request,...
Hello
My plan is to let a user to upload an excel file, once uploaded I will be displaying editable form which contains the content of the uploaded excel, once user confirms the input is correct, he/she hits the save button and these items are saved at some model.
For this, I have written this view and form:
form:
IMPORT_FILE_TYPES = ...