django

Overriding Django Admin's main page? - Django

Hi folks, I'm trying to add features to Django 1.2 admin's main page. I've been playing with index.html, but features added to this page affect all app pages. Any ideas on what template I'm supposed to use? Thanks loads!! ...

Qooxdoo REST JSON request problem - unexpected token and then timeout

Hello! I am learning Qooxdoo framework and I am trying to make it work with a small Django web service. Django webservice just returns JSON data like this: { "name": "Football", "description": "The most popular sport." } Then I use the following code to query that url: var req = new qx.io.remote.Request(url, "GET", "application/json...

How can I unit test django messages?

In my django application, I'm trying to write a unit test that performs an action and then checks the messages in the response. As far as I can tell, there is no nice way of doing this. I'm using the CookieStorage storage method, and I'd like to do something similar to the following: response = self.client.post('/do-something/',...

Django: Site-Wide URL Prefix

I've built a Django site that will live at the root when it's live. Right now it's functioning perfectly at the IP address. For testing purposes, the client has pointed a proxy url at it, but the url has /folder/path in it, so none of the URL patterns match. I put (/folder/path)? into all the url patterns so they now respond, but all of ...

Inlines in Django Admin

I have two models, Order and UserProfile. Each Order has a ForeignKey to UserProfile, to associate it with that user. On the django admin page for each Order, I'd like to display the UserProfile associated with it, for easy processing of information. I have tried inlines: class UserInline(admin.TabularInline): model = UserProfile...

Django model fields getter / setter

Hi, is there something like getters and setters for django model's fields? For example, I have a text field in which i need to make a string replace before it get saved (in the admin panel, for both insert and update operations) and make another, different replace each time it is read. Those string replace are dynamic and need to be d...

Using Memcached in Python/Django - questions.

I am starting use Memcached to make my website faster. For constant data in my database I use this: from django.core.cache import cache cache_key = 'regions' regions = cache.get(cache_key) if result is None: """Not Found in Cache""" regions = Regions.objects.all() cache.set(cache_key, regions, 2592000) #(25...

What mock object framework should I use when developing in Python on the Google App Engine?

I am developing an application on the Google App Engine using Python (and Django, if that matters). Which mock object framework should I help to assist with unit tests? I see there are a number of standalone projects (i.e. http://python-mock.sourceforge.net), but I'm not sure if there's something built-in that I can use. Any ideas? ...

How to use the same template for different query sets?

I'm new to Django and setting up my first site. I have a Share model and a template called share_list.html that uses an object_list like this: {% for object in object_list %} I setup haystack using their tutorial and the search template looks like this: {% for result in page.object_list %} I would like to modify the search.html tem...

Using Pisa to write a pdf to disk

I have pisa producing .pdfs in django in the browser fine, but what if I want to automatically write the file to disk? What I want to do is to be able to generate a .pdf version file at specified points in time and save it in a uploads directory, so there is no browser interaction. Is this possible? ...

Django 1.2 Equivalent of QuerySet.query.as_sql()

In Django 1.1 I was able to produce the SQL used by a QuerySet with this notation: QuerySet.query.as_sql() In Django 1.2, this raises as AttributeError. Anyone know the Django 1.2 equivalent of that method? Thanks ...

How can I use Django with MySQL in MAMP stack?

Hi all, I have difficulty especially in installing MySQLdb module (MySQL-python-1.2.3c1), to connect to the MySQL in MAMP stack. I've done a number of things such as copying the mysql include directory and library (including plugin) from a fresh installation of mysql (version 5.1.47) to the one inside MAMP (version 5.1.37). Now, the M...

django integrate htmls into templates

hi guys, i have a django 'templating' question if i have in views.py: def cv(request): if request.user.is_authenticated(): cv = OpenCv.objects.filter(created_by=request.user) return render_to_response('cv/cv.html', { 'object_list': cv, }, context_instance=RequestContext(request)) and in cv.html something like: ...

Geo Location with javascript .....

I am trying to geolocate a user then present him a driving path to my location using django and javascript. The js i am using is over here: http://github.com/gvkalra/random/blob/master/templates/home/index.html If to the geolocation prompt I say "Share my location", the system is not working. I am unable to figure out why ..... Please h...

Django LocaleMiddleware determines the language for me. How do I know what language it determined?

I need to know what language it returns, so that I can perform my own actions. ...

Your Django Development process/steps (Step by Step)

I want to know step by step process of how folks develop on Django here. I have seen that whenever I try to create a website in Django, I always get confused amongst: DB Schema/models.py UI/Template Structure Login module urls.py views.py How do you approach this? I may have missed something. You do not need to elaborate everything, ...

Internal Server Error with mod_wsgi [django] on windows xp

when i run development server it works very well, even an empty project runing in mod_wsgi i have no problem but when i want to put my own project i get an Internal Server Error (500) in my apache conf i put WSGIScriptAlias /codevents C:/django/apache/CODEvents.wsgi <Directory "C:/django/apache"> Order allow,deny Allow from all </Dir...

An unhandled exception was thrown by the application.

Hello I've created my new site using DjANGO AT FIRST Everything is okay startapp,syncdb......Etc but the problems its this massage Unhandled Exception An unhandled exception was thrown by the application. you can see http://www.daqiqten.com/ this is my index.fsgi and .htacces index.fcgi #!/usr/bin/python import sys, os # Add a c...

Django 0.0.0.0:80; can't access remotely

Hello, I'm trying to access my Django server from another computer on the same network. I've set up my server and can view everything correctly usingpython manage.py runserver and going to http://127.0.0.1:8000 but when I try to use python manage.py runserver 0.0.0.0:80, I can't view my Django page from another computer. The computer h...

Django: How do I add arbitrary html attributes to input fields on a form?

I have an input field that is rendered with a template like so: <div class="field"> {{ form.city }} </div> Which is rendered as: <div class="field"> <input id="id_city" type="text" name="city" maxlength="100" /> </div> Now suppose I want to add an autocomplete="off" attribute to the input element that is rendered, how would ...