django

how to disable bulk_action in django 1.1 beta

Hi, I am using django 1.1 beta release. In my project I want to use bulk_action in some models only. How can I disable bulk_action from the remaining models? I want to totally remove action label along with the checkbox; in other words as it would look in Django 1.02. ...

Django: accessing the model instance from within ModelAdmin?

I've got a model for Orders in a webshop application, with an auto-incrementing primary key and a foreign key to itself, since orders can be split into multiple orders, but the relationship to the original order must be maintained. class Order(models.Model): ordernumber = models.AutoField(primary_key=True) parent_order = models....

integrating Satchmo with existing django project

I have a running django project and i want to integrate Satchmo with that project. Problem is that instead of putting satchmo into my site-packages directory, i want it to be used as a django app i.e all the satchmo apps like product, shipping, satchmo-utils etc are to be in a directory say satchmo-apps in my django project. But by doing...

run code after transaction commit in Django

Is there any way to run some code after transaction commit in Django? I need to send some messages to a rabbitmq server for offline processing, but the message gets to the consumer before the Django transaction is commited. My message is sent in the post_save signal of the model. What I'm looking for is a similar mechanism, using sign...

Use Django Framework with Website and Stand-alone App

Hey, I'm planning on writing a web crawler and a web-based front end for it (or, at least, the information it finds). I was wondering if it's possible to use the Django framework to let the web crawler use the same MySQL backend as the website (without making the web crawler a "website" in it's self). Cheers, Pete ...

caching issues in MySQL response with MySQLdb in Django

I use MySQL with MySQLdb module in Python, in Django. I'm running in autocommit mode in this case (and Django's transaction.is_managed() actually returns False). I have several processes interacting with the database. One process fetches all Task models with Task.objects.all() Then another process adds a Task model (I can see it in ...

How to split render django's ModelMultipleChoiceField in template file?

I want to make (ordered) Song list form. models.py class Song(models.Model): title = models.CharField(max_length=60) class List(models.Model): title = models.CharField(max_length=100) songs = models.ManyToManyField(Song, through='Order') class Order(models.Model): list = models.ForeignKey(List) song = models.Forei...

django: second for loop produces no elements

I'm fetching a recordset, and doing a for loop to display the data like so: {% for category in categories %} {"img":"{{ category.pr_image }}", "url":"{{ category.pr_store_url }}", "type":"ca", "price":"{{ category.pr_price }}", "store":"{{ category.pr_store }}", "name":"{{ category.pr_name }}", "lat":"{...

How to force user logout in django?

In my django app under certain conditions I need to be able to force user logout by a username. Not necessarily the current user who is logged in, but some other user. So the request method in my view doesn't have any session information about the user that I want to logout. I am familiar with django.auth, and with auth.logout method, b...

Django -- I have a small app ready, Should I go on private VPS or Google App Engine?

Hi, I have my first app, not that big, but it is the first step. (next big one on the way) Now if I want to put it on my own Linode VPS, I have to configure mod_python or mod_wsgi, as well as memcache, Ngix, mySQL or Postgresql, etc. to make it work. If I put it GAE, All I have to do is convert the models to use GAE's API. What I like...

Django Powered Sites

Are there any sites in the top Alexa or Compete 1000 powered by Django? I cannot find any. If not, is there a reason for this? It seems like a framework suited for rapid development with deployment options (fast cgi, mod_wsgi, mod_python) that are efficient. Am I missing something? ...

Help with Django app and payment systems (general queries)

Hi guys, So I'm working on an app in Django, however this is my first time venturing into advance integration for a webapp with payment systems (I used to work with paypal/2checkout so it was pretty no-skill-required). My partners have chosen PaymentExpress, and there are several sets of API (all of which are pretty new to me) and they...

Is BigTable slow or am I dumb?

I basically have the classic many to many model. A user, an award, and a "many-to-many" table mapping between users and awards. Each user has on the order of 400 awards and each award is given to about 1/2 the users. I want to iterate over all of the user's awards and sum up their points. In SQL it would be a table join between the ma...

Django models overriding save / use a signal / or use a modelform?

I realize this has been asked before, but I wasn't able to find a question that really dealt with what I'm trying to do. I think it's pretty simple, but I'd like to know what the general population thinks is best form here. Lets say we have the following: models.py class TestClass(models.Model): user = models.ForeignKey(User) ...

Django: Add number of results

I'm displaying the number of search results, however, i do more than one search. So to display the number of results i'd have to add them up. So i've tried this: <p>Found {{ products|length + categories|length + companies|length }} results.</p> But i get an error. How do i do this? ...

Force query parameters to be matched in urls.py

I want the WHOLE url after the slash to be passed to a script. If I do : url(r'^(?P<id>.*)$', alias.get, name="alias"), Then I only get the path component and not the query parameters passed to my function. I then have to : def urlencode(dict) : if len(dict) == 0 : return "" params = {} for k, v in dict.items() : ...

list display

I am storing a image location in my model field named as 'banner'.now in list_display page i want to show that field as a image rather than the name.I have made a function which is the location of image but i cant see the image instead that i am seening string in my model banner is character varying field any solution? def get_bann...

Grabbing POST variable in form clean() method

Is there a straightforward way to access a POST variable to complete some custom validation lookups in a admin form field's clean method? def clean_order_price(self): if not self.cleaned_data['order_price']: try: existing_price = ProductCostPrice.objects.get(supplier=supplier, product_id=self.cleaned_data['product'], is_late...

Display model URL in admin

I've got a couple of models. Neither have any list view other than their admin entries. For that reason, it's a bit of a pain to manually work out the URLs for model instances. I would like to show a link on the listing and detail admin views that takes me directly to the public view. I can do the nonsense that works creates the URL but...

Iterating through large lists with potential conditions in Python

I have large chunks of data, normally at around 2000+ entries, but in this report we have the ability to look as far as we want so it could be up to 10,000 records The report is split up into: Two categories and then within each Category, we split by Currency so we have several sub categories within the list. My issue comes in efficien...