Hello all,
I know there are lots of example for how to set http://domainname.com/username
url. But how to set http://username.domainname.com url in django?
Thinking a way to have a unique url for each user as http://username.domain.com like http://garry.posterous.com/
Thanks
...
We know there is a value() method of QuerySet, when there is a foreignkey (author, for example), it result like:
[{ 'author_id':3, ... }, ...]
I want a result like:
[{ 'author':{'name':'dave',...}, ... }, ...]
and I tried select_related, but values() won't show the detail of the foreignkey, what shall I do?
...
I am trying to download mp3 file to users machine without his/her consent while they are listening the song.So, next time they visit that web page they would not have to download same mp3, but palypack from the local file. this will save some bandwidth for me and for them. it something pandora used to do but I really don't know how to.
...
Hello
I am trying to retrieve the absolute path (starting with http://) while calling a FileField at the template.
How can I achieve this ?
ie:
{{fl.uploadedfile}} -> returns relative path like media/uploads/
while I want http://www.blabla.com/media/uploads/
Cheers
...
Hi
Out of curiosity, I'd like to know if anyone knows of any somewhat large website that started out using Django, Ruby on Rails, or similar frameworks, but later switched to using something more "enterprise-ish" such as .NET or JSP.
(I tried searching for this question, but couldn't find any.)
Thanks
...
I already looked at the most popular Django hit counter solutions and none of them seem to solve the issue of spamming the refresh button.
Do I really have to log the IP of every visitor to keep them from artificially boosting page view counts by spamming the refresh button (or writing a quick and dirty script to do it for them)?
More ...
Hi,
I have python threaded application + Postgres. I am using Django's ORM
to save to Postgres..
I have concurrent save calls. Occasionally 2 threads save with the
same primary key which leads to an issue.
Postgres log:
ERROR: duplicate key value violates unique constraint "store_pkey"
STATEMENT: INSERT INTO "store" ("store_id", "ad...
WheneverI try to upload an mp3 file through a CMS I built with the Django Admin contrib pacakage, the server takes a couple minutes, then gives me a "Connection was reset" error.
I'm running Django on a CentOS server using NGINX which is proxying Apache with mod_wsgi for python. Could this be a server settings issue?
...
I'm developing a Django project where I need to serve temporary images, which are generated online. The sessions should be anonymous; anyone should be able to use the service. The images should be destroyed when the session expires or closes.
I don't know, however, what's the best approach. For instance, I could use file-based sessions ...
I'm trying to use Django transactions on MySQL with the commit_on_success decorator. According to the documentation, "If the function raises an exception, though, Django will roll back the transaction." However, this doesn't seem to work for me:
>>> @transaction.commit_on_success
... def fails():
... Site.objects.create(name="New ...
In our webapp we needed to allow dashes "-" in our usernames.
I've enabled that for the consumer signup process just fine with this regex
r'^[\w-]+$'
How can I tell the admin app so that I can edit usernames in auth > users to allows the "-" character in usernames? Currently I am unable to edit any usernames with dashes in them as it...
I'm struggling a little to work out how to follow the relation and count fields of objects.
In my Django site, I have a profile model:
user = models.ForeignKey(User, unique=True)
name = models.CharField(_('name'), null=True, blank=True)
about = models.TextField(_('about'), null=True, blank=True)
location = models.CharField(_('location'...
Hey guys,
My problem is similar to http://stackoverflow.com/questions/622982/django-passing-custom-form-parameters-to-formset/624013
Ive have these classes
class Game(models.Model):
home_team = models.ForeignKey(Team, related_name='home_team')
away_team = models.ForeignKey(Team, related_name='away_team')
round = models.Fore...
I'm trying to customize the Django Admin.
models.py
=============
class Question(models.Model):
poll = models.ForeignKey(Poll)
name = models.CharField(max_length=100)
pub_date = models.DateTimeField('date published')
admin.py
===========
class QuestionAdmin(admin.ModelAdmin):
list_display = ('name', 'poll'. 'pub_dat...
I am looking at using PayPal as a payment option for my custom shopping cart I have built. I already have a cart set up, and a checkout 'complete'. It asks the user for their address. Once they have completed all the fields, they hit 'Pay with PayPal'. This does not send them to PayPal yet. First it processes the data they entered, THEN ...
It seems most documentation recommends :
template_values = {}
template_values["foo"] = "bar"
return render_to_response(path, template_values, context_instance=RequestContext(request)
Why don't I use :
template_values = RequestContext(request)
template_values["foo"] = "bar"
return render_to_response(path, template_values)
...
I'm trying to do pagination with the page parameter in the URL (instead of the GET parameter). I also want my pagination to be shared code across multiple different templates.
Given that, I think I need to do something like this :
urls.py:
url(r'^alias/page;(?P<page>[0-9]+)/(?P<id>.*)$', alias.get, name="alias"),
tempaltes/alias.htm...
Hello folks,
The app runs fine using django internal server however when I use apache + mod_python I get the below error
File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75, in __init__
raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SE...
I have the following in models:
class Companies(models.Model):
ComName = models.CharField(max_length=255)
ComURL = models.CharField(max_length=1024,null=True)
class Products(models.Model):
PrName = models.CharField(max_length=255)
PrCompany = models.ForeignKey(Companies)
and the following in the template:
{% i...
So I have two models, a Ranking model and a UserRanking model. The app centers on people taking a list of items and ranking them (ex: "Best Movies of 2008"). The Ranking model is the overall aggregate ranked list, which is calculated from all the different UserRankings that people create for that list. So for each Ranking, there are a bu...