I have a couple of Django models set up like this:
class Group(models.model):
name = models.CharField(max_length=50, unique=True)
class Section(models.Model):
name = models.CharField(max_length=50, unique=True)
slug = models.SlugField(help_text='Auto generated')
groups = models.ManyToManyField(Group, blank=True)
In on...
I'm having some trouble using get_absolute_url in a template. It seems to work fine if I just pass in one of my store objects and say {{ store.get_absolute_url }}, but if I have to iterate through a dictionary of stores and then use the get_absolute_url function, it returns nothing. Exactly what I'm doing is below:
class Store(Ethical...
I have a requirement something like this:
As soon as the user signsup(and will be in the waiting state untill he confirms his email address), a session variable is set something like "FIRST_TIME_FREE_SESSION_EXPIRY_AGE_KEY"(sorry if the name sounds confusing!) which will be set to a datetime object adding 8hrs to the current time.
Ho...
One of my functions returns a 'msg' object... which is merely a string.
I got into 2 for loops in the function.
msg=''
for e in example:
msg+= "some crap"
msg+= "some crap1"
for sl in somelist
msg+= v.somevalue
msg+="-------------"
return httpresponse(msg)
There's an example of the code.
'somelist' conta...
I can't post image because I'm new so here's a link of what I want.
So, I have the model on the left and I want the view on the right.
As of now, I'm looping over every thread I'm interested in. Template code:
{% for thread in threadlist %}
{% for post in thread.postlist %}
...
Model code:
class Thread (models.Model):
...
def po...
Are there any admin extensions to let bulk editing data in Django Admin? (ie. Changing the picture fields of all product models at once. Note that this is needed for a users POV so scripting doesn't count.) Any thoughts on subject welcome.
...
I love iPython's so many features, magic functions.
I recently upgraded to the latest 0.10 version. But I face following common problems:
%hist one of the most frequently used magic functions, doesn't exist.
dreload doesn't seems to work (works only for modules?).
run -d for debugging doesn't work
At times, typed characters are not di...
Is there a wildcard character in Django to use in an Objects.filter?
For example, is there a character that is the equivalent of doing this:
Prices.objects.filter(a = example1,
b = example2,
#c=example3)
i.e. instead of commenting out c, could I not put c = WILDCARD or c = *... you get the ...
I was reading the Rails testing doc and it looks quite comprehensive in explaining the different type of tests. I also noticed the section on Testing Routes. Does anyone know how I can do that in Django/Python? I have a bunch of web sites with some common urls that I need to test. Here's how it's done in Ruby:
def test_should_route_...
Hi, I have a simple model like this one:
class Artist(models.Model):
surname = models.CharField(max_length=200)
name = models.CharField(max_length=200, blank=True)
slug = models.SlugField(unique=True)
photo = models.ImageField(upload_to='artists', blank=True)
bio = models.TextField(blank=True)
class Images(models.Model...
Hi guys, im using django-registration, all is fine, the confirmation email was sending in plain text, but know im fixed and is sending in html, but i have a litter problem... the html code is showing:
<a href="http://www.example.com/accounts/activate/46656b86eefc490baf4170134429d83068642139/">http://www. example.com/accounts/activate...
When I call getRecurringPaymentsProfileDetails through the sandbox everything works fine, but when I switched to my live site I started getting 10001 error "Internal Error"
Here is what gets returned:
{'ack': 'Failure', 'timestamp': '2009-08-25T04:33:23Z', 'l_severitycode0': 'Error', 'l_shortmessage0': 'Internal Error', 'l_longmessage0...
I am trying to use the django-tagging in one of my project and run into some errors.
I can play with tags in the shell but couldn't assign them from admin interface.
What I want to do is add "tag" functionality to a model and add/remove tags from Admin interface.
Why is it the "tags" are seen by shell and not by "admin" interface? Wha...
I'm getting the following error message:
Reverse for 'code_front' with arguments '()' and keyword arguments '{'category_slug': u'code'}' not found.
I am new at this, please help.
...
I am writing a Player model class in Python with Django, and I've ran into a small problem with the password member. I'd like the password to be automatically hashed upon assignment, but I can't find anything about overloading the assignment operator or anything. Is there any way I can overload the assignment of password so as to automa...
Let's say I want to use a different template for the add page but not the edit. What would be the best way to accomplish that? I was thinking either subclassing add_view or change_view, or alternatively maybe subclass some InlineModelAdmin method.
What's your guys take on this? Thanks.
...
Hello ,
I have two models ,
class A(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=200)
type = models.CHarFIeld(max_length=200)
..
..
..
class B(models.Model):
a= models.ForeignKey(A)
state = models.CharField(max_length=200)
now when i am seeing the page of class A i...
I need to solve a gender translation problem, and Django doesn't seem to have gettext contexts implemented yet...
I need to translate from english:
<p>Welcome, {{ username }}</p>
In two forms of spanish, one for each gender. If user is a male:
<p>Bienvenido, {{ username }}</p>
and if is a female:
<p>Bienvenida, {{ username }}</p>...
From Django Documentation:
If you define a custom LANGUAGES
setting, it's OK to mark the languages
as translation strings (as in the
default value displayed above) -- but
use a "dummy" gettext() function, not
the one in django.utils.translation.
You should never import
django.utils.translation from within
your setti...
I have never created a high traffic site so I have no idea what the best long term plan is. There is no room for a dedicated server in the budget. I'm currently using VPS hosting for my current site. I was going to stick with VPS and migrate grails. I looked at Django and python hosting plans (which look cheaper than VPS plans) from fatc...