django

Django admin choice field dynamically populated by generic foreign key's model fields

Say I have the following simple models for some tagging application (this is simplified from the actual code): # Model of tag templates class TagTemplate(models.Model): name = models.CharField() content_type = models.ForeignKey(ContentType) class Tag(models.Model): template = models.ForeignKey(TagTemplate) object_id = m...

In Django Admin, I want to change how foreign keys are displayed in a Many-Many Relationship admin widget

I have a ManyToMany relationship: class Book: title = models.CharField(...) isbn = models.CharField(...) def unicode(self): return self.title def ISBN(self): return self.isbn class Author: name = models.CharField(...) books = models.ManyToManyField(Book...) In the admin interface for Author I get a multiple sel...

Powerfull WYSIWYG editor with upload image capability

Can any one please recommend a powerful WYSIWYG (commercial/open source) editor which has a image upload capability.Which iam planning to use for my publishing platform. I have been looking for it since morning but could not able to find it. I found CKeditor+CKFinder , but CKFinder is not available in django/ python language. I tri...

Problems with django managers

Hi! I have following model: class UserProfile(models.Model): """ User profile model, cintains a Foreign Key, which links it to the user profile. """ about = models.TextField(blank=True) user = models.ForeignKey(User, unique=True) ranking = models.IntegerField(default = 1) avatar = models.ImageField(uploa...

Django & webapp living together on GAE?

Is it possible to have both frameworks available? So that I could have from google.appengine.ext import webapp from django.template.loader import render_to_string class MainPage(webapp.RequestHandler): def get(self): self.response.out.write(render_to_string('some.template')) and from django.http import HttpResponse def...

Whats the proper idiom for naming django model fields that are python reserved names?

I have a model that needs to have a field named complex and another one named type. Those are both python reserved names. According to PEP 8, I should name them complex_ and type_ respectively, but django won't allow me to have fields named with a trailing underscore. Whats the proper way to handle this? ...

Passing Python Data to JavaScript via Django

I'm using Django and Apache to serve webpages. My JavaScript code currently includes a data object with values to be displayed in various HTML widgets based on the user's selection from a menu of choices. I want to derive these data from a Python dictionary. I think I know how to embed the JavaScript code in the HTML, but how do I emb...

django and south migration with conflicts (0007_two ... and 0007_one) how to solve ?

Hi I want to use south in my django project as migration tool, but I have problem with using south in multiuser scenario: two guys working in same time and create on diffrent machines two migrations with same number on first PC: 0007_extend_lizard.py on second PC: 0007_swap_name_adopter.py in this case i can run ./manage migrate --...

Beginning Django: performing sub-selects and other complex queries

Hello, I want to execute a semi-complex query in Django. For example I want something that is like this: SELECT b.*, (SELECT count(id) FROM comments c WHERE c.blog_id = b.id) AS number_of_comments FROM blog b WHERE 1 From my PHP background, Code Igniter and Zend Framework has "query builders". Where you can built an SQL-query using...

Django custom context processor being called twice per request

I created a simple custom context processor that needs to only be run once per request. After putting in some logging hooks I found that it is being called twice per request. Is this a known "feature" that a missed in the docs? Is it related to the number of templates in the inheritance tree? Is it a bug in 1.03? Thanks. ...

Django ORM, filtering objects by type with model inheritence.

So I have two models... Parent and Child. Child extends Parent. When I do Parent.objects.all(), I get both the Parents and the Children. I only want Parents Is there a Parent.objects.filter() argument I can use to only get the Parent objects instead of the objects that extend parent? ...

Alternate datasource for django model?

I'm trying to seamlessly integrate some legacy data into a django application. I would like to know if it's possible to use an alternate datasource for a django model. For example, can I contact a server to populate a list of a model? The server would not be SQL based at all. Instead it uses some proprietary tcp based protocol. Copying ...

IDLE and Python have different path in Mac OS X

I am running Mac OS X 10.5.8. I have installed Python 2.6 from the site. It's in my application directory. I have edited my .bash_profile to have: # Setting PATH for MacPython 2.6 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}" export PATH export PATH=/usr/lo...

Decorators should not have side effects?

Editing because the initial code was confusing. I would assume these two things to be same, #I would use either of these #Option 1 def bar(*args): pass foo = deco(bar) #Option2 @deco def foo(*args): pass However if the decorators deco has side effects, this is not guaranteed. In partcicular, this was my ecpectation form a de...

How to integrate JQGrid with Django/Python

Anybody out there who have tried to use JQGrid a Jquery plugin with django? Please share your knowledge/code samples Gath ...

What are the best benefits of using Pinax ?

I recently discovered Pinax that appear to be an django stack with added most-used apps so easy and speed up development. I never used or heard of Pinax before and like to know if you have feedback about it. I love Django and would like to understand what are to parts of web dev Pinax helps with and using what tools. ...

[Django] Custom storage system for GridFS (MongoDB)?

Can anyone point me to any projects/django apps that provide a plugable custom storage system so I can use GridFS with Django to store file uploads? I've found django-mongodb but it doesnt seem to support GridFS, nor does django-storages. Edit: I plan to run mysql for the normal database requrements and only use mongodb for file stora...

DJANGO - How to use "Custom Attributes" in an external app form without permanent change

I would like to change an external apps form fields to use in a particular template of my application. I would like to give attribute values for the fields as shown below. body = forms.CharField(widget=forms.Textarea(attrs={'class':'textarea', 'rows':'', 'cols':"", 'onclick':"this.style.height='250px';"})) title = forms.CharField(widg...

Multiple visualizations in one page

I am using python-visualization library for computing the datasource. I tried to put more than one visualization in a single page. Both are line charts and data comes from a seperate URLs for each visualizations. <script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt; <script type="text/javascript" src="/site...

Need some help in starting with Django

Downloaded Django, ran install, now I need to setup a database -- And I'm stuck. How can I do this? Tried following instructions on-site; no good. Thanks! ...