Currently, django.contrib.comments sends the user to the preview page if there is any error on the form.
I am using comments in the context of a blog and I would much rather that the user stayed on the page they were on if something went wrong with the submission. As far as I can tell though, this is hard-coded in django.contrib.commen...
I'd like to be able to iterate over a dictionary while inside of a for loop in a Django template.
For the sake of this sample, consider the following:
items_list = [ {'key1':'value1', 'key2':'value2'}, {'key1':'value5', 'key2':'value9'} ]
Method #1:
{% for dict in items_list %}
{% for key,value in dict %}
<tr>
...
I'm looking for a web charting library for use with python that has drill-down/clickthrough support for a django project. (Clicking on a portion of the chart, triggers an event/refresh to display new data based on the data point clicked).
Something like what is seen here:
http://blogs.adobe.com/flexdoc/2007/03/chart_data_drill_down_exa...
I have a list of tuples, each containing a find/replace value that I would like to apply to a string. What would be the most efficient way to do so? I will be applying this iteratively, so performance is my biggest concern.
More concretely, what would the innards of processThis() look like?
x = 'find1, find2, find3'
y = [('find1', 'rep...
Hi,
I'm making a django app that needs to be able to make emails and then send these out at a given time. I was thinking i could use django-mailer to put things in que and then send it of. But even though theire sample case list, lists that this is a feature, I cant seem to find out how.
What I need is to be able to set a 'when_to_send...
I'm new to python/django. I need to store an arbitrary number of fields in a django model. I'm wondering if django has something that takes care of this.
Typically, I would store some XML in a column to do this. Does django offer some classes that makes this easy to do whether it be XML or some other(better) method?
Thanks,
Pete
...
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<h1>{% block title %}{% endblock %}</h1>
</body>
</html>
This is my template, more or less. The h1 heading is always the same as the title tag. The above snippet of code is not valid because there can't be two blocks with the sa...
I'm hosting a site on WebFaction using Django/mod_python/Python2.5. I've recently run into the concept of static files (when setting up my Django admin).
From what I understand, serving static files is simply the idea of telling the server to serve files directly from a specific directory, rather than first routing the request through a...
I've been messing around with Django and the Django ORM at home, and I've got to say, I feel it is one of the best out there in terms of ease of use.
However, I was wondering if it was possible to use it in "reverse".
Basically what I would like to do is generate Django models from an existing database schema (from a project that do...
That:
{{ wpis.entry.lastChangeDate|date:"D d M Y" }}
gives me (why?):
2009-07-24 21:45:38.986156
and i don't know how to skip fraction part...
In my model i have:
addedDate = models.DateTimeField(default=datetime.now)
...
The django admin's User management gives us easy access to setting a User's group allegiances via the list for picking the Groups. This is the ManyToMany relationship default widget for assignment. And for the most part that's nice for User creation from the get go.
However, say I have a huge number of users and groups...I'd like the ...
A simple form with ModelChoiceField displayed as radio buttons (the inherited widget).
I'm using an onchange event to POST, everytime a user selects a radio button:
shipping_choice = ShippingChoiceField(
queryset=ShippingMethods.objects.all(),
empty_label=None,
widget=forms.RadioSelect(attrs={
'class': 'order',
'onchange': '$("#...
For my first Django app, I'm trying to write a simple quote collection site (think bash.org), with really simple functionality, just to get my feet wet. I'm using sqlite as my database, since it's the easiest to setup.
Here's my only model right now:
class Quote(models.Model):
text = models.TextField();
upvotes = models.Intege...
For example, I have a model Posts and Comments.
Post.objects.annotate(Count('comment'))
I am making such query to get count of comments for every post. But in template i should check if this value greater than 4. As I know there is no such templatetag. For now I put method in model that executes comparision operation.
The question is...
I'm trying to set up Review Board, which uses Django, on WinXP with Apache 2.2 and mod-python.
I have a default Python install, but I want to use a different instance. The default is c:/python25, but I want d:/xxx/python25. mod-python has a config option to change the path, but I don't want to have to recompile mod_python (as the code i...
I can't find it anywhere, so your help will be nice for me :) Here is that field:
categories = models.ManyToManyField(fragmentCategory)
FragmentCategory:
class fragmentCategory(models.Model):
CATEGORY_CHOICES = (
('val1', 'value1'),
('val2', 'value2'),
('val3', '...
This is a python application that's supposed to get all the followers from one table and get their latest updates from another table. - All happening in the dashboard.
dashboard.html:
http://bizteen.pastebin.com/m65c4ae2d
the dashboard function in views.py:
http://bizteen.pastebin.com/m39798bd5
result:
http://bizteen.pastebin.com/m...
I've got models like those in django:
class User(models.Model):
name = models.CharField(max_length = 128)
class Message(models.Model):
sender = models.ForeignKey(User, related_name = 'messages_sent')
recipient = models.ForeignKey(User, related_name = 'messages_recieved')
subject = models.CharField(max_length = 128)
body = mod...
I have a small typography related templatetag library that I use on almost every page. Right now I need to load it for each template using
{% load nbsp %}
Is there a way to load it "globally" for all views and templates at once? Putting the load tag into a base template doesn't work.
...
So I'm attempting to write a Django reusable app that provides a method for displaying your Twitter feed on your page. I know well that it already exists 20 times. It's an academic exercise. :)
Directory structure is pretty simple:
myproject
|__ __init__.py
|__ manage.py
|__ settings.py
|__ myapp
|__ __init__.py
|__ adm...