django

Django: use get_prep_value() to remove dollar signs?

Is it advisable to use get_prep_value() in my Django Field subclass to do this (my custom field is a sub-class of DecimalField): def get_prep_value(self, value): from decimal import Decimal value = Decimal(value.replace('$', '')) return super(MyCustomField, self).get_prep_value() Does this pose a problem with django's Mode...

How to get current_app for using with reverse in multi-deployable reusable Django application?

I'm writing reusable app. And I want to deploy it several times. Here is urls.py: urlpatterns = patterns('', (r'^carphotos/', include('webui.photos.urls', app_name='car-photos') ), (r'^userphotos/', include('webui.photos.urls', app_name='profile-photos') ),) and photos/urls.py: urlpatterns = patterns('webui.photos.views', url(r'^$'...

Django autocomplete widget example

Hi at all, I am looking for a working simple example on autocomplete widget for foreign key in Django. I have found many example but I don't understand and doesn't work. This is my model: class profile(models.Model): user = models.ForeignKey(User, unique=True) class profileForm(ModelForm): user = forms.CharField(widget=AutoComplete...

What do I need to do to port an admin application to frontend?

I have a simple admin database. I want to port it to search and results pages. How do I achieve this? Thanks EDIT re Jonathan Fingland's comment from django.db import models class Lawyer(models.Model): firm_url = models.CharField('Bio', max_length=200) firm_name = models.CharField('Firm', max_length=100) first = models....

Debugging Django Forms validation errors

One of my forms fails on form.is_valid() First time I debug a Django form so I am not too sure where to look forms.py class ImageForm(forms.ModelForm): def __init__(self,user,*args,**kwargs): super(ImageForm,self ).__init__(*args,**kwargs) # populates the form class Meta: model = KMSImageP fields = ('name', ...

how can i use django.utils.safestring.py

from django.utils.safestring import * print SafeString('\u3042') print '\u3042' \u3042 \u3042 who can give me a better example. thanks ...

Django custom manager with ManyToManyField

I have a model with a ManyToManyField with a through model in which there is a boolean field that I would like to filter upon. from simulations.models import * class DispatcherManager(models.Manager): use_for_related_fields = True def completed(self): original = super(DispatcherManager,self).get_query_set() re...

ValueError in Django

I'm getting a strange error and can't figure out why. I'd appreciate any input. I've been stuck on this for a few days. Here is my code: models.py class Employee(models.Model): lastname = models.CharField(max_length=75) firstname = models.CharField(max_length=75) position = models.ForeignKey(Position) jurisdiction =...

Can you recommend a good django file manager for the admin?

I'm looking for a robust, stable django file manager for use in the django admin. My requirements wish list: Allows browsing and selecting files on the server (e.g. images) Allows uploading files. Multiple file upload would be great (with, e.g. uploadify) Does not require me to use a custom field in my model definitions (like django-f...

which django cache backend to use?

I been using cmemcache + memcache for a while with positive results. However cmemcache lately not tagging along well and I also found that it's now recommended. I have now installed python-memcached and its working well. As I have decided to change would like to try some other cache back end any recommendation. I have also came across...

How to modify a template of a reusable app in Django?

For example, let's say I want to modify the breadcrumbs block of the admin/change_list.html template in the Django admin. If I try to override this template like this: {% extends "admin/change_list.html" %} {% block breadcrumbs %} ... my changes ... {% endblock %} then Django goes into an infinite recursion when trying to load my over...

what is the best system to run django on?

what is the best system to run django on, operating sysyem, database, web server etc considering robustness, simplicity, maintence cost, maintence reliability, pricing, upgrades for the application and upgrade of the django and other system component any body knows? ...

django ajax load() - possible to update two or more divs, with part of the returned django view context?

Hi, I'm using the load method to replace the contents of ONE div. $( '#ajax_tbody_result' ).html( ' ' ).load(url); Now I'm wondering whether it is possible to call the url, get the return values, split them up and update TWO or more divs in my template. Thus the solution would be to get some objects out of the returned django c...

Django and PHP together with lighttpd?

I'm playing around with Django and have built my personal homepage in Django, but I want to use my wordpress blog as a path. For example if I want to path /blog/ in Django or in lighttpd so it will render the PHP wordpress site what is the best way to do that? I tested with proxy.server in lighttpd with no luck - it seems like Django ...

Using Beaker on Google App Engine (Django)

How do we use Beaker to implement sessions on Google App Engine? (I say Beaker because gmemsess is short-lived, and therefore not suitable). There seem to be no examples online. We're using Django 1.1 via App Engine Helper (not app-engine-patch). ...

GAE and Django: What are the benefits?

Currently I have a website on the Google App Engine written in Google's webapp framework. What I want to know is what are the benefits of converting my app to run with django? And what are the downsides? Also how did you guys code your GAE apps? Did you use webapp or django? Or did you go an entirely different route and use the Java api?...

Confused about the urls in app-engine-patch

In app-engine-patch (http://code.google.com/p/app-engine-patch/) ... How on earth does the sample application know that the /person url maps to the myapp application? I'm trying to understand the url structure to everything and I've looked through the urls and I can't see it anywhere... Source can be seen on mercurial here: http://...

Django sub-url deployment on Ubuntu server

Hello, I need to set up a django development environment that is publicly viewable on the internet (I am doing this for school, and my projects need to be viewable by my professor, this isn't a setup that needs much security). I have a virtual server running Ubuntu 8.04 LTS. I need to have multiple django applications running in subdir...

Django: # in url as a character?

I've made a Django application that uses tags. When i use tag 'c#' and try to redirect to mysiteaddress/tags/c# on server it redirects to ../tags/c and shows me stuff connected to 'c' tag, but when I do the same on my local development machine it redirects me to c%23 and works correctly. What should I change to make it work on production...

Django : View returns JSON content_dictionary, how to decode in Javascript

Let me explain what I'm trying to do, and if someone could point the correct way to do it & a solution to where I'm stuck that would be great ! Someone types url www.ABC.com/showItem/Blackberry I lookup "Blackberry" in my database and find data for it, now I want to show its details one a page. Hence in the View I do this return_dat...