django

Raise 404 and continue the URL chain

I've got a URLs pattern like this: urlpatterns = ( url(r'^$', list_titles, name='list'), url(r'^(?P<tag>[a-z\-0-9]+?)/$', list_titles, name='filtered-list'), url(r'^(?P<title>\S+?)/$', show_title, name='title'), ) The filtered-list and title match the same things. If there is is a available list of things matching the tag...

Avoid copying when adding a large file to FileField

I'm dealing with some quite large files which are uncomfortable to upload via http, so my users upload files using FTP which my code then needs to move into FileField.upload_to (where they normally end up when uploaded via HTTP). My problem is, the commonly suggested method of using django.core.files.File: from django.core.files import ...

Apache/Django freezing after a few requests.

I'm running Django through mod_wsgi and Apache (2.2.8) on Ubuntu 8.04. I've been running Django on this setup for about 6 months without any problems. Yesterday, I moved my database (postgres 8.3) to its own server, and my Django site started refusing to load (the browser spinner would just keep spinning). It works for about 10 mintue...

HTTPResponse - Return organised data (table?)

My Webservice is currently returning a HTTPResponse which contains thousands of data from a mySQL database (via a Objects.filter). It's currently just displating them in a very boring way! I'm looking to organised this data in some way. What would be ideal is two things: The possibility of having a table and maybe having some kind of s...

VMWare guest web-server not reachable from host

Software: VMWare Fusion 2.05 on Mac OS X 10.5.8 (also applies to VMWare Workstation 6.5.2 on Vista, used for verification of the issue) Guest: Ubuntu Server 9.04 (also applies to Ubuntu Desktop 9.04, used for verficiation of the issue) VMWare Networking: bridged Router: Apple TimeCapsule, latest firmware Issue: After successfully insta...

Model Formset overwrites existing entries instead of adding

I have a Model Formset that should take files sent via POST and add them to the database. However, the form includes the IDs of files already in the database, which leads to information being overwritten. For example, the HTML output for the form looks like this: <label for="id_files-0-theFile">File:</label> <input type="file" nam...

How can I make a Django query for the first occurrence of a foreign key in a column?

Basically, I have a table with a bunch of foreign keys and I'm trying to query only the first occurrence of a particular key by the "created" field. Using the Blog/Entry example, if the Entry model has a foreign key to Blog and a foreign key to User, then how can I construct a query to select all Entries in which a particular User has wr...

Has anybody tried html2pdf in django?

Ok when im gonna make reports with Java I use iReport for JasperReports Template designs. But with python the alternative is html2pdf - pisa. It would be great to see an example of this. Any hint would be appreciated. Tks. ...

django admin: company branches must manage only their records across many models

One company with many branches across the world using the same app. Each branch's supervisor, signing into the same /admin, should see and be able to manage only their records across many models (blog, galleries, subscribed users, clients list, etc.). How to solve it best within django? I need a flexible and reliable solution, not hack...

Why is Standard Input is not displayed as I type in Mac OS X Terminal application?

I'm confused by some behavior of my Mac OS X Terminal and my Django manage.py shell and pdb. When I start a new terminal, the Standard Input is displayed as I type. However, if there is an error, suddenly Standard Input does not appear on the screen. This error continues until I shut down that terminal window. The Input is still being ...

Django popup box Error?? Running development web server

I have my Django site up and running, and everything works fine EXCEPT: When I first go to my site http://127.0.0.1:8000 A popup box comes up and says "The page at http://127.0.0.1:8000 says" And just sits there You have to hit OK before anything is displayed. What is going on here? ...

How to avoid calling get_query_set()

How can I make Django avoid calling ChangeList's get_query_set() method in file django.contrib.admin.views.main.py? I don't want to append any data, I want it to not call that method at all. Thanks. ...

Django: do I need to restart Apache when deploying?

I just noted an annoying factor: Django requires either a restart of the server or CGI access to work. The first option is not feasible if you don't have access to the Apache server process. The second, as far as I know, is detrimental to performance, and in general the idea of running a CGI makes me uncomfortable. I also recently saw a...

How to populate a list with items.count() from a queryset sorted by a datetime field

I had a hard time formulating the title, so please edit it if you have a better one :) I'm trying to display some statistics using the pygooglechart. And I am using Django to get the database items out of the database. The database items has a datetime field wich i want to "sort on". What i really want is to populate a list like this. ...

Django - Overriding get_or_create with models.py

Hi all, I have a class in which I want to override the get_or_create method. Basically if my class doesn't store the answer I want it do some process to get the answer and it's not provided. The method is really a get_or_retrieve method. So here's the class: class P4User(models.Model): user = models.CharField(max_length=100, ...

app-engine-patch "DJANGO_STYLE_MODEL_KIND = False" settings causes the Dango Administration fail.

The Problm occurs when Iset DJANGO_STYLE_MODEL_KIND = False in the file "settings.py". The datastore model entity of admin users in GAE will change from auth_users to Users, then try to login to admin and server error occured. That is, if DJANGO_STYLE_MODEL_KIND set to "False", the Django admin funciton will fail because of the name of d...

Save a file using a model and non-model-based Form in Django

I have a model with a FileField and a form that has a FileField as well. The form is not a ModelForm based on the model but it's a regular Form. How do I save the uploaded file from the form to the model? ...

Why remove django DATABASE_OPTIONS's "init_command set engine=INNODB" after table creation?

http://docs.djangoproject.com/en/1.0/ref/databases/#creating-your-tables says: Another option is to use the init_command option for MySQLdb prior to creating your tables: DATABASE_OPTIONS = { "init_command": "SET storage_engine=INNODB", } This sets the default storage engine upon connecting to the database. After your tables have ...

Threaded Django task doesn't automatically handle transactions or db connections?

I've got Django set up to run some recurring tasks in their own threads, and I noticed that they were always leaving behind unfinished database connection processes (pgsql "Idle In Transaction"). I looked through the Postgres logs and found that the transactions weren't being completed (no ROLLBACK). I tried using the various transactio...

django deployment issue with mod_wsgi

Hello I am trying to deploy my django project which is located at home/doga/headend/ and just to run it on the localhost (will be a LAN accessable project). My main problem is that I can use the site well however the /admin/ folder is giving me Internal Server Error error. anyway here is my etc/apache2/sites-available/default file <Vir...