django

Django + Emacs (as TextMate replacement)

There is any complete tutorial how to configure emacs for using with Django (1.1) (on Mac)? Im thinking about switch from TextMate to Emacs to have multiplatform editor for django. I have my fav. theme from textmate and I want to convert this to emacs (maybe is "converter" for this?). Switching from Textmate is a good idea ? ...

Are nested inline forms possible in Django Admin models?

I was about to ask essentially the same question as this one. However, since no one answered it, I'll assume that nested inline forms aren't possible. So instead I'll just ask how you would approach designing something like this in Django: A retailer sells clothing. Each sweater design has a Style number. This style is available in di...

Generic view 'archive_year' produces blank page

I am using Django's generic views to create a blog site. The templates I created, entry_archive_day, entry_archive_month, entry_archive, and entry_detail all work perfectly. But entry_archive_year does not. Instead, it is simply a valid page with no content (not a 404 or other error. It looks like it sees no objects in **object_lis...

How do I migrate a model out of one django app and into a new one?

I have a django app with four models in it. I realize now that one of these models should be in a separate app. I do have south installed for migrations, but I don't think this is something it can handle automatically. How can I migrate one of the models out of the old app into a new one? Also, keep in mind that I'm going to need this t...

WMD in Django Admin?

I know how to use WMD and other such javascript editors in regular django forms using widget=. However, how do I use WMD for text fields in the Django admin? On top of that, how do I use it for the content field on contrib.flatpages in the admin? Also, I think I might like to use the StackOverflow fork of WMD, so I would like any speci...

How to switch web app from HTML to Markdown?

I've got a django-powered site. Currently, all of the textfields are just plain old text inputs that take raw HTML. I have no fancy editor or anything. I would like to start using Markdown and WMD to make things easier for everyone. Do I have to run some sort of script to go over every text field in the database to convert all the HTML...

TypeError when passing dictionary arguments to a view through urls.py

I'm trying to pass keyword arguments to a Django view using a dictionary, but I keep running into a TypeError when I try to access the URL (The error is: "add_business_contact() got an unexpected keyword argument 'info_models'"). The code is: urlpatterns = patterns('business.views', # ... url(r'^(?P<business_id>[\w\._-]+)/edit_c...

django Datefield to Unix timestamp

Hello In a model I have a such field: mydate = models.DateField() now a javascript graph function requires unix timestamp such as "1196550000000", how can I return the unix timestamp of my mydate input. Thanks ...

Loose coupling of apps & model inheritance

Hi there, I have a design question concerning Django. I am not quite sure how to apply the principle of loose coupling of apps to this specific problem: I have an order-app that manages orders (in an online shop). Within this order-app I have two classes: class Order(models.Model): # some fields def order_payment_complete(self)...

Alternative upload method for Django FileField

Hi I have some django models that use a FileField, and users have been uploading files in the admin interface. We now have a problem that some files are quite big (1-3G), which makes http upload tricky. There is a "container" class, and then "file" classes with a FK to the container. I have used inlines in the admin gui to make this ea...

Changing Cookie header value at every request in Django

Hi, Somehow the values for in the Cookie change at every request. As I'm using the auth and session middleware (which add the Vary: Cookie header). I'm not able to cache the pages. Any hints how I can change this behaviour? ...

Is there a class library diagram for django?

I'm looking for a way to find out the class structure at a glance for django. Is there a link to an overview of it? ...

technology recommendation for LAN Dashboard

I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need, as well as to rep...

database design for multiple similar content types

I've worked on multiple sites recently with similar content types but haven't gotten the design I'm looking to achieve. I have multiple types of content article, interview, video, gallery, blog, etc. All of these models have very similar properties (title, slug, body, pub_date, etc). And since I'm using django and the admin, almost all ...

Django, login form in home pages and others?

Hi guys, i want to know how ill show the Form Login in the home pages and others? Thanks guys :) ...

Django saving objects - works, but values of objects seem to be cached until I restart server

I'm writing an app for tagging photos. One of the views handles adding new tags and without boilerplate for POST/GET and handling field errors it does this: tagName = request.cleaned_attributes['tagName'] t = Tag.objects.create(name = tagName) t.save() Now in a view for another request to retrieve all tags I have: tags = Tag.objects....

Django: Limit SQL execution time

I'm building an API for access to my underlying models, and I would like my users to be able to do some fancy things (like filter on columns with __ operators). The only problem is sometimes these can take a long time. How can I limit a fetch to a certain amount of resources? Time, cpu-cycles, memory, etc. My current code (if it help...

app-engine patch - how do Iget Django system error messages in foreign languages?

Bonjour, Guten Morgen, Merhaba etc etc Has anyone used foreign languages with app-engine-patch? I am on version 1.1 In settings.py I have: ....... Enable I18N and set default language USE_I18N = True LANGUAGE_CODE = 'tr' Restrict supported languages (and JS media generation) LANGUAGES = ( ('tr', 'Turkish'), ('en', 'English'...

unit test about upload xls file

this is my test code: def test_import_data(self): f = open('commend/fixtures/Book2.xls') postdata = {'datatype':'intonetwork','datafile':f} response = self.client.post('/commend/saledata/import_data/',postdata) self.failUnlessEqual(response.status_code, 200) but in the view code: file = request.FILES['data...

Django annotate() multiple times causes wrong answers

Django has the great new annotate() function for querysets. However I can't get it to work properly for multiple annotations in a single queryset. For example, tour_list = Tour.objects.all().annotate( Count('tourcomment') ).annotate( Count('history') ) A tour can contain multiple tourcomment and history entries. I'm trying to get ho...