Hello,
I want to be sure that for some URL of my website, SSL will be use.
I saw a lot of answer already on SO.
http://stackoverflow.com/questions/724968/force-redirect-to-ssl-for-all-pages-apart-from-one
So I think I will use mod_rewrite.
My question is more about how to configure the Virtual Host to run my Django Application over H...
Hi - I am working on a django project and would like to include a slug at the end of the url, as is done here on stackoverflow.com: http://example.com/object/1/my-slug-generated-from-my-title
The object ID will be used to look up the item, not the slug -- and, like stackoverflow.com, the slug won't matter at all when getting the link (j...
I have an admin-controlled feature (importing database) that can take some time to finish, so I want to show some feedback to the user during that time - for example a progress bar, or just some messages. Even sending the page in parts during the long action would suffice.
What would be the simplest way to do it in Django?
...
Simply, I write:
# forms.py
class NoteForm(ModelForm):
def __init__(self, *args, **kwargs):
super(NoteForm, self).__init__(*args, **kwargs)
#add attributes to html-field-tag:
self.fields['content'].widget.attrs['rows'] = 3
self.fields['title'].widget.attrs['size'] = 20
class Meta:
model = Note
fields = ('title'...
When using the standard authentication module in django, a failed user authentication is ambiguous. Namely, there seems to be no way of distinguishing between the following 2 scenarios:
Username was valid, password was invalid
Username was invalid
I am thinking that I would like to display the appropriate messages to the user in thes...
simple%20minds is displayed when do this:
{{ rec.artist_name }}
How do I remove the %20...and make it spaces?
When I put | safe as a fitler, the error is:
Could not parse the remainder: ' | safe' from 'active.artist_name | safe'
Thanks.
...
from django.core.cache import cache
def testcache():
cache.set('test','I am putting this message in',3333)
print cache.get('test')
It just prints "None"
This is in "ps aux":
dovr 2241 0.0 0.8 57824 2144 ? Ssl 04:20 0:00 memcached -d -u root -m 3900 -p 11211
dovr 2247 0.0 3.7 83696 9800 ...
I have a Django model for Cat which has a foreign key Dog. The Dog model has a date key timestamp. I want to order the cats, using Cat.objects.order_by, according to the timestamps of their respective dogs. How do I do that?
...
Is there any way to track active users in django?
I have seen a few online solutions to the problem:
http://magicpc.wordpress.com/2009/09/22/get-online-users-in-django/
being one of those. But it seems rather odd to modify the model structure just to solve this simple problem. I would like to know if there is any quick solution around...
Hi Guys,
I have a model with a bunch of choices, that are in the DB configured as below.
COL_CHOICES =(
(1, 'Not Applicable'),
(2, 'Black'),
)
COL2_CHOICES =(
(1, 'Green'),
(2, 'Blue'),
)
etc.
I want to display all these options as a menu in my templates, (to be used ...
I want to send a value to the server.I send it using:
$.post("http://127.0.0.1:8000/search/",{'long':"30"});
and my views.py is:
def search(request):
lon = request.POST.get('long','')
place = Places.objects.filter(longtitude__icontains=lon)
if place is not None:
return render_to_response('sr.html', {'place...
Python's locale implementation seems to want to either read the locale from system settings or have it be set via a setlocale call. Neither of these work for me since I'd like to use the capabilities in a web application, where the desired locale is the user's locale.
And there are warnings in the locale docs that make the whole thing s...
I'm trying to modify the adimn interface. I need a custom type of textbox that does some pre/post processing on the text. If I understand correctly, a custom widget is the way to go about this.
Where is a good tutorial how to write custom widgets for Django?
...
I am developing an app for the iphone.The thing is that i want to send the values of longitude and latitude i get from the phone using javascript to a server commanding it to search for something.Do i have to read about cross domain stuff?How could this be done?
I know that i can use Ajax but it can serve me if i refer to the same domain...
Hello, I want to host several sites with under the same server which uses Debian 5, say I have site1,site2 and site3 and assume my ip is 155.55.55.1
155.55.55.1:80 for my site1 , script resides at /opt/django/site1/
155.55.55.1:8080 for my site2 , script resides at /opt/django/site2/
155.55.55.1:8090 for my site3 , script resides at /opt...
I am using Django.
In a regular form, the user enters "Gerry & Pacemakers".
(Notice the Ampersand sign.)
When I go views.py...
def myview(request):
q = request.GET.get('q','').strip()
print q
q is "Gerry"...but it's supposed to be "Gerry & Pacemakers"...encoded
Is the correct way doing this by using urllib??
How do I encod...
I'm completely stumped as to why this isn't working:
flight = Flight.objects.get(pk=flight_id)
print "old", flight.route.pk ## `route` is a ForeignKey field to model Route
print "new", new_route.pk
flight.route=new_route # new_route is a newly created Route object
flight.save()
print "db", Flight.objects.get(pk=flight_id).route.pk
th...
I have 03 models book->target_readers and book has collection.
class Book(models.Model):
def __unicode__(self):
return "%s (%s)" % (self.title, self.reference)
reference = models.CharField(max_length=100)
title = models.CharField(max_length=200)
collection = models.ForeignKey(Collection)
class Collection(models....
I'm rather new to Django and I'm using Django 1.0.
I have this:
forms.py:
class MyForm(forms.Form):
extra_cheeze = forms.BooleanField(required=False,
initial=False,
label='Extra cheeze')
views.py:
def order_something(request):
form = MyForm(request.PO...
SelectDateWidget is very convenient but it normally seems to return dates in the format "%Y-%m-%d". It doesn't take a format parameter and doesn't have much documentation. Anyone run into this or have an idea how to work around it to get the output of the date into another format? There is this ticket, #6231 saying that there's a fix to ...