Hi. I tried profiling my web application and one of the bottlenecks reported was the lack of gzip compression. I proceeded to install the gzip middleware in Django and got a bit of a boost but a new report shows that it is only gzipping the HTML files i.e. any content processed by Django. Is there a way I could kludge/hack/force/make the...
Hello, I am trying use the django ORM to get a list by year of all my articles with an article count beside it, such as this:
2010 (5 articles)
2009 (4 articles)
2008 (9 articles)
I have tried things such as:
archive = Articles.objects.dates('created', 'year').annotate(archive_count=Count('created'))
or:
archive = Articles.objects.v...
Hello everyone.
Here is my issue. I am new to python/django (about 2 months in). I have 2 tables, Project and Status. I have a foreign key pointing from status to project, and I am looking to try to display the value of the foreign key (status) on my project template, instead of the address of the foreign key.
Here is my models.py...
I am developing a system using Django + Postgresql. It's my first time with postgresql but I chose it because I needed the transactions and foreign key features.
In a certain view I have to lock my tables with AccessExclusiveLock, to prevent any read or write during this view. That's because I do some checks on the whole data before I s...
I am a very young programmer and I am trying to do something in Python but I'm stuck. I have a list of users in Couchdb (using python couchdb library & Flask framework) who have a username (which is the _id) and email. I want to use the list of email addresses in a select box in a jinja2 template.
My first problem is how to access the e...
I have a django app hosted via Nginx and uWsgi. In a certain very simple request, I get different behaviour for GET and POST, which should not be the case.
The uWsgi daemon log:
[pid: 32454|app: 0|req: 5/17] 127.0.0.1 () {36 vars in 636 bytes} [Tue Oct 19 11:18:36 2010] POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ => generated 80...
I'm going to manage some documentation using Django (I come from Sphinx) in order to have more control on the output. The docs are in rst (restructured text) in a git archive, and it's trivial to display them in HTML using a filter. My problem is that they are quite long, and I'd like to have more control on how the pagination goes, so I...
I'm using django and have a page of search results that I want to be able to filter by category with ajax (jquery) requests. There's a filter bar on the side of the page and when someone selects certain categories and clicks submit, those corresponding results should show up on the page. My code looks something like this:
<input type=...
Consider I have defined the following models:
class Tag(models.Model):
name = models.CharField(max_length=20)
class Entry(models.Model):
title = models.CharField(max_length=100)
date = models.DateField()
tags = models.ManyToManyField(Tag)
and the following model form:
class EntryForm(forms.ModelForm):
tags = CharField(max...
Hello everyone.
I have a small question to ask the community. I am wondering why my foreign key will not show up when I go to my edit form. When I go to edit the information, all my data is populated except for status (which is a foreignkey that points from the status table to project table), which is left with nothing selected. I ...
I'm using Django and Celery to communicate with RabbitMQ. I've registered all of the tasks, and put them in the CELERY_IMPORTS tuple in my settings file. When I run a task, I get the "not registered" error message.
# tail -f /var/log/celeryd.log
. logfile -> /var/log/celeryd.log@INFO
. events -> OFF
. beat -> OFF
. task...
Hi. easy_thumbnails is a big help when making models or views for thumbnails.
I am using the templatetag (via template, not via model) and easy_thumbnails creates sucessfully the thumbnail files.
what happen when I want to use easy_thumbnails via view, not model o templatetag (the rendering of the images is via ajax, and django will ...
Either my google searching has completely left me or there's hardly any documentation/tutorials for django-socialregistration. Too bad, because it seems like a nice enough app. Through some trial-and-error, I have managed to get it mostly running on my site.
My question, using django-socialregistration how do I request permission for t...
I want the ability to let users indicate what countries they have visited.. my models.py looks something like this:
class User(models.Model):
name = models.CharField(max_length=50)
countries = models.ManyToManyField(Countries)
class Countries(models.Model):
#This is where I don't know what to do.
#The end goal i...
Goal: On submission of a form to add/update/delete objects an email is sent out with the current contents of the DB object and the new contents of the DB object in html.
Example
Object Title was oldTitle and has been changed to newTitle
Object Date was oldDate and has been changed to newDate
My assumption this can be done two d...
I'm interested in subclassing django's ImageFileField to allow access to the image IPTC metadata, something like:
>>> from myapp.models import SomeModel
>>> obj = SomeModel.objects.all()[0] # or what have you
>>> obj.image.iptc['keywords']
('keyword','anotherkeyword','etc')
... the docs say to read over django's internal code, which I...
In my application I've added "Facebook Comment Box" on different pages for different objects. Each object has it's own comments list so I need to provide a unique (across the site) xid for every single one of them. So what would be the best approach for achieving this ? Some abstract model that all other models will inherit ? Dummy model...
I'm building a django application that will be operated via desktop application. Key feature for now is sending/storing files. Basically I need a django view with URL on which I can send files with POST and this view will store the files. Currently I have something like this :
def upload(request):
for key, file in request.FILES.item...
I've got strange issue - I hope someone run similar problem before.
I'm trying to cache content from different subdomains connected via wildcard to my django application: poczta-online.com .
So when I get to krakow.poczta-online.com i run differend code in view than poczta-online.com - simple middleware for that like here: http://stack...
Hi:
I'm defining a create() method in django-piston. I need to be able to receive and image with its description enconded in JSON. How to do it? Shall they be processed in two separate HTTP requests?
...