django

Django on CentOS

I'm looking to use Django on a shared host that's running an unknown version of CentOS. My main problem is trying to interface with a database. The server has MySQL installed, but not MySQL-python. I initially thought of suggesting running "yum install MySQL-python", but apparently the version of MySQL-python that's in the default reposi...

How do I add a non official database backend to Django?

It looks like Django's looking in the django/db/backends folder but when i install various adapters they install to /django itself - can I point to that? Copying them to the backends doesn't seem to work because it always says blablalb.base is missing... ...

How do I set up a model to use an AutoField with a legacy database in Python?

I have a legacy database with an integer set as a primary key. It was initially managed manually, but since we are wanting to move to django, the admin tool seemed to be the right place to start. I created the model and am trying to set the primary key to be an autofield. It doesn't seem to be remembering the old id in updates, and it do...

Comparing two date ranges when one range has a range of starting dates.

I've got the next problem up from this one: http://stackoverflow.com/questions/143552/comparing-date-ranges The solution to comparing two ranges is the query: SELECT * FROM periods WHERE NOT (range_start > @check_period_end OR range_end < @check_period_start) I have the added problem. I am allowing people to enter a ran...

Accepting email address as username in Django

Is there a good way to do this in django without rolling my own authentication system? I want the username to be the user's email address instead of them creating a username. Please advise, thank you. ...

Multiple Databases in Django 1.0.2 with custom manager

I asked this in the users group with no response so i thought I would try here. I am trying to setup a custom manager to connect to another database on the same server as my default mysql connection. I have tried following the examples here and here but have had no luck. I get an empty tuple when returning MyCustomModel.objects.all(...

How can you have Wordpress-like custom fields using Django flatpages?

One of the features that makes a CMS like WordPress powerful is the ability to add additional fields that may be used in the template. WordPress has what it calls custom fields. Is there a way to do that using Django's flat pages? If not, is there another Django app that will allow page creation with the option of adding additional field...

How can you get future-dated posts in Django?

I just want to do a basic site in Django and the flatpages app is super simple, but it doesn't support a couple of things that I need, namely custom fields and future-dating. That is setting a publish date to some point in the future rather than publishing immediately. What's the best option for getting future-dated posts in Django? ...

How to get page parent when using Django flatpages?

Since Django urls are arbitrary, including those set when you create flatpages. How can you figure out what a page's parent is? That is if I create a page /about/contact/, then when I am on the contact page (in the template), how can I figure out what the parent page is? Is there a standard way to do this? Or do I just split the slug on...

How do I run more than one Django site on a single server using fastcgi?

I'm running Django on a server with a dozen or so virtual hosts set up. The first Django site I've put together works great, but I'm about to set up a second. Do I need to run a second fastcgi process? For the first site I'm running fcgi this way: /home/django/app1/manage.py runfcgi protocol=fcgi host=127.0.0.1 port=8081 The nginx ...

Is there anything better than flatpages for Django?

I was wondering if there's anything better than the flatpages app for Django, because flatpages doesn't even support things like status (draft, published) or publish date. Is there anything out there? ...

How to set correct value for Django ROOT_URLCONF setting in different branches

I've put site directory created by django-admin startproject under version control (Mercurial). Let's say, the site is called frobnicator. Now I want to make some serious refactoring, so I clone the site using command hg clone frobnicator frobnicator-refactoring` but ROOT_URLCONF in settings.py still says frobnicator.urls. Is there ...

Finding free slots in a booking system

In my question about searching for date ranges I tried simplifying the problem and inadvertently posed a different and simpler problem. Rather than complicate that question with an edit I am going to ask the problem I actually intended. I have two tables Property and Booking. Bookings have a foreign key to Properties and also start an...

Django, Flash, Cross Domains, and jQuery.Player.js

I'm writing a site in Django that involves playing music, and so I needed an mp3 player. I don't know Flash, and don't really have a desire to learn it, so when I found http://github.com/breily/jquery.player.js/tree/master I was pretty happy. It worked great. Well on my development server anyway. To serve the static files for my site, ...

Is there a way to resize images in Django via imagename.230x150.jpg?

There's a nice plugin for Frog CMS that lets you just type in yourpicture.120x120.jpg or whatever, and it will automatically use the image in that dimension. If it doesn't exist, it creates it and adds it to the filesystem. http://www.naehrstoff.ch/code/image-resize-for-frog I was wondering if there's anything like this in Django/Pytho...

Python Django Template: Iterate Through List

Technically it should iterate from 0 to rangeLength outputting the user name of the c[i][0].from_user...but from looking at example online, they seem to replace the brackets with dot notation. I have the following code: <div id="right_pod"> {%for i in rangeLength%} <div class="user_pod" > {{c.i.0.from_user}} </div> {% endfor %} ...

How can I specify a prepopulated value for many to many relationships in django 1.0 (flatpages)?

Django flatpages uses a many-to-many relationship with the django Site model class FlatPage(Model) ... sites = ManyToManyField(Site) You must select a site when creating a new flatpage. While I might utilize multiple sites later, right now it's unnecessary an annoying. I want to have the current (and only) Site preselected o...

Django blows up with 1.1, Can't find urls module ... totally confused

EDIT: Issue solved, answered it below. Lame error. Blah So I upgraded to Django 1.1 and for the life of me I can't figure out what I'm missing. Here is my traceback: http://dpaste.com/37391/ - This happens on any page I try to go to. I've modified my urls.py to include the admin in the new method: from django.contrib import admin ...

Basic MVT issue in Django

I have a Django website as follows: site has several views each view has its own template to show its data each template extends a base template base template is the base of the site, has all the JS/CSS and the basic layout So up until now it's all good. So now we have the master head of the site (which exists in the base template), ...

Django restapi passing parameter to read()

In the test example http://django-rest-interface.googlecode.com/svn/trunk/django_restapi_tests/examples/custom_urls.py on line 19 to they parse the request.path to get the poll_id. This looks very fragile to me. If the url changes then this line breaks. I have attempted to pass in the poll_id but this did not work. So my question is ...