django

templatetags don't refresh

I have two templatetags in my app which contain forms which show entries in db. When I alter data or add new entry to db, the forms show the old data. While in admin panel everything is correct (updated). When I restart the server (I mean manage.py runserver) forms show updated db entries. How to make the forms show updated data? regard...

Can I use a ForeignKey in __unicode__ return?

I have the following classes: Ingredients, Recipe and RecipeContent... class Ingredient(models.Model): name = models.CharField(max_length=30, primary_key=True) qty_on_stock = models.IntegerField() def __unicode__(self): return self.name class Recipe(models.Model): name = models.CharField(max_length=30, primary_...

How do I install MySQL and the python MySql package on OSX Leopard? Or how do I learn about being a web developer using OSX?

I'm new to the Mac OS and I'm just about ready to throw my brand new MacBook pro out the window. Every tutorial on setting up a Django development environment on Leopard is insidiously wrong. They are all skipping over one step, or assuming you have setup something one way, or are just assuming that I know one thing that I must not. I...

Integrating smartgwt and web2py.

I'd like to build an application using smartgwt and web2py. I am new to both. Ultimately what I would like to do is display objects obtained from a web2py backend in a smartgwt TileGrid. Can anyone enumerate the broad strokes of what needs to be done? Or point me to any useful resources? Any information that would apply more to django...

FastCGI, Lighttpd Interface Error/Operational Error.

I am getting an Interface Error/ Operational Error while running my Django application with FastCGI.On checking the access log ( of lighttpd) i find these errors pop up which are usually related to closing some db connection or the other. The browser displays one of the two things - Unhandled Exception or Connection Terminated unsuccessf...

Ordering admin.ModelAdmin objects in Django Admin

Let's say I have my pizza application with Topping and Pizza classes and they show in Django Admin like this: PizzaApp - Toppings >>>>>>>>>> Add / Change Pizzas >>>>>>>>>> Add / Change But I want them like this: PizzaApp - Pizzas >>>>>>>>>> Add / Change Toppings >>>>>>>>>> Add / Change ...

What are the implications of using GPL django apps in a non-GPL django project?

If I was to integrate a third-party GPLv3,v2 or LGPL django app in my django project, would the licence apply to the complete project or just the third-party application I'm using? ...

Define css class in django Forms

Assume I have a form class SampleClass(forms.Form): name = forms.CharField(max_length=30) age = forms.IntegerField() django_hacker = forms.BooleanField(required=False) Is there a way for me to define css classes on each field such that I can then use jQuery based on class in my rendered page? I was hoping not to have to m...

ForeignKey form restrictions in Django

I'm using Django to write a blog app, and I'm trying to implement a hierarchical category structure. Each category has a "parent" ForeignKey pointing back to the same Category model. I want to allow admins to add categories, and I want the interface to allow them to select a category's parent category. However, I want to avoid I'm-my-...

Naming Python loggers

In Django, I've got loggers all over the place, currently with hard-coded names. For module-level logging (i.e., in a module of view functions) I have the urge to do this. log= logging.getLogger( __name__ ) For class-level logging (i.e., in a class __init__ method) I have the urge to do this. self.log= logging.getLogger( "%s.%s" % (...

How to store a dictionary on a Django Model?

I need to store some data on a Django model. These data are not equal to all instances of the model. At first I thought on subclassing the model, but I'm trying to keep the application flexible; if I use subclasses, I'll need to create a whole class each time i need a new kind of object, and that's no good. I'll also end up with a lot o...

Django, Rails Routing...Point?

I'm a student of web development (and college), so my apologies if this comes off sounding naive and offensive, I certainly don't mean it that way. My experience has been with PHP and with a smallish project on the horizon (a glorified shift calendar) I hoped to learn one of the higher level frameworks to ease the code burden. So far, I...

How does Django serve media files?

I have set up a Django application that uses images. I think I have set up the media settings MEDIA_ROOT and MEDIA_URL correctly. However the images don't show up. Do you know what can be the problem? Let consider this example: The image files are under /home/www/media/app/photos and we are trying to request http://example.com/photos/1...

How to sort a list of objects in Python, based on an attribute of the objects?

I've got a list of Python objects that I'd like to sort by an attribute of the objects themselves. The list looks like: >>> ut [<Tag: 128>, <Tag: 2008>, <Tag: <>, <Tag: actionscript>, <Tag: addresses>, <Tag: aes>, <Tag: ajax> ...] Each object has a count: >>> ut[1].count 1L I need to sort the list by number of counts descending. ...

Django tag cloud plugin

Is there a good Django app out there that can take a list of tags and their frequencies of occurrence and render a tag cloud for them? ...

web framework(s) memory footprint

Hypothetically, if I were to build the same app using a few popular/similar frameworks, say PHP(cakePHP|Zend), Django, and Rails, should the memory consumption of each be roughly the same? Also, I'm sure many have evaluated or used each and would be interested in which you settled on and why? ...

Selling "downloadable" content - handling behind the scenes

I was thinking of throwing together a quick PHP or Django site for independently selling some "downloadable" content (music/mp3's) to which I am the artist/rights-holder. I began to wonder if there are already some decent best-practices on how to handle the downloads - like how long a link should last for a user, the process of allowin...

Combining multiple Django templates in a single request

Hello, I am wondering if someone can help me figure out the best approach to the following problem. I'm building a web application which uses Django templating to construct its web UI component. There are a number of common HTML elements such as the header / footer, HTML head, masthead etc. I'd like to code these once and "include/co...

How to produce a 303 Http Response in Django?

Last couple of days we were discussing at another question the best to manage randomness in a RESTful way; today I went to play a little bit with some ideas in Django only to find that there is no easy standard way of returning a 303 response (nor a 300 one, btw), that is, there doesn't seem to exist an HttpResponseSeeOther inside django...

Django apps equivalent in ASP.NET MVC?

I currently develop with Django, but want to be ready when a future client inevitably requests a site done in ASP.NET MVC. While most of the structure and flow of ASP.NET MVC is more or less identical to Django and RoR, the one part I'm not sure about is the Apps methodology Django employs to make code reuse easier. Is there an equival...