django

django: order and show name conflict.

Hey; i have a model using user as a forgignKey. and in the admin, i need it show as full name instread of username. then i applied class CollaboratorInLine(admin.StackedInline): model = Collaborator #list_display = ('collaborator__collaborator_first_name') extra = 0 form =CollaboratorForm #raw_id_fields=("collabora...

Paragraph translation in Python/Django

Hello, I translated a site using django i18n, I have no problems for menus, little paragraph, etc.. The thing I dont understand is for translating big paragraph. On my site, the admin can write some news by administration page, but he wants them in differents languages. I can imagine some methods to do that : one field per langage, b...

Any job queue systems that allow scheduling jobs by date?

I have a Django application. One of my models looks like this: class MyModel(models.Model): def house_cleaning(self): // cleaning up data of the model instance Every time when I update an instance of MyModel, I'd need to clean up the data N days later. So I'd like to schedule a job to call this_instance.house_cleaning() ...

eclipse, django, pydev - slow update with the script?

It's weird. Let say I make a minor change in my view or urls file. I do "Run as -> PyDev: Django", and it takes several times to update it.... and most of the time I have keep doing it.... I cleaned the cache and all that, but doesn't help. I am using the development server, anyone has experience in this? Thanks!! Edit It seems lik...

Django: How do I explicitly make a query with a HAVING clause?

I need to execute some SQL that looks like this: select approve_firm_id,approve_dt,approve_result from main_approve group by approve_firm_id having MAX(approve_dt) and approve_result=0; it runs (mysql-5.1), but if I try in the Django model like this: Approve.objects.annotate(max_dt=Max('approve_dt')). filter(max_dt__gt=0).filte...

Can deleting a django Model with a ManyToManyField create orphaned database rows?

If I have two classes A and B with a many to many relationship and I want to delete an instance of A, do I need to remove all of its related Bs first or will Django sort that out for me? I obviously don't want to leave orphaned rows in the join table. Does it make any difference if the ManyToMany field is declared on class A or B? Doe...

Getting list of all strings from a Django app

Eclipse has a function called Externalise all Strings, which will move all strings to an properties file. Is there such a solution available for Django/Python? Basically I have a large project with number of views/models/templates, and going through all of them, and putting string -> _("string") etc is a big pain, so is there a way to...

django avatar custom template tag

My site is quite visual and I would like to make use of users avatars all over the site so I think that writing a custom template tag is the best way to go. My UserProfile is associated with a User and has an profile_pic. I am making use of django-imagekit and hence the ImageModel comes into play class UserProfile(ImageModel): p...

Compress Python objects before saving to cache

What's the fast method to compress Python objects (list, dictionary, string, etc) before saving them to cache and decompress after read from cache? I'm using Django and I hope to add compress/decompress support directly in Django's cache backend which makes it available to all my Django apps. I looked into django/core/cache/backends/me...

Django Model for storing Internet Usage Stats

Hi, I'm writing a small Django-based frontend to collect and graph internet usage statistics. Currently, from our ISP, we get monthly text files that show the average bytes/second for every 5-minute interval. E.g.: Date Time In Out 28.03.2010 00:00:00 204304 228922 28.03.2010 00:05:00 104231 222998 28.03.2010 00:10...

Django queries: how to annotate with a filtered count?

Suppose I have a Book model with a language field and a foreign key to a Publisher model. Currently I use a Count annotation in a custom Publisher manager to allow me to add to the admin a sortable column with the number of books by each publisher. (see http://stackoverflow.com/questions/3491766/how-to-add-a-sortable-count-column-to-the...

django grappelli, filebrowser and Tiny MCE insert image dialog

So, I found django admin interface called 'grappelli'. Looked at the screenshots and decided that I like it. Went to sources page and checked out trunk. Set it up and noticed that it looks nothing like screenshots. No dashboard, no side panel, different colors of the elements and model item lists are very narrow. From that point I'm won...

Is there any analog of django's forms in Ruby on Rails?

Hi guys, Is there any analog of django's forms in Ruby on Rails? Thanks, Alexey Zakharov ...

Django Url structure for a Site

So I ran through a lot of Django tuts and I seem to understand the basics. I know everything about the urls.py. But now I need to design the urls for the whole site. It seems not as easy as I imagined. I would like to achieve the following. overall structure: main-site/ main_site/projects/ main_site/projects/project1 /...

Country-based Super User Access, and modifiying Django Auth

I'm looking to give super user access to users of a program I'm devving. All the entities have a country id value, so i'm just lookign to hook up my user model to have a country ID Looking at Django Auth, It should be nice and easy to add a super_user_country_id field. However, how frowned upon is it to modify the core django classes?...

Performance impact for specifying qualitative temporal information in Django signals?

When defining a Signal in Django, should you specify qualitative temporal information such as pre and post in the name of the Signal, or as an argument? If as an argument, what range of values should you use? For instance, say I want to define Signals before and after an operation X, one way is: pre_x_signal = Signal(providing_args = [...

How do I use Django's MultiWidget?

The documentation is a bit lacking with respect to this feature. from django import forms class TwoInputWidget(forms.MultiWidget): """An example widget which concatenates two text inputs with a space""" def __init__(self, attrs=None): widgets = [forms.TextInput, forms.TextInput] I can see I need to create a "widgets" ...

Filter results for Django paginator in template

I'm filtering out results from my page_obj in a generic view to only show entries published in the same language as the languge currently set by django-cms (http://www.django-cms.org/en/documentation/2.0/i18n/). This works fine, but adding in support for Django pagination (http://docs.djangoproject.com/en/1.2/topics/pagination/) causes ...

Django Admin application no working on URL

Hi, In my urls file I have configured the django admin application to run off the url /adminDJ/. However it doesn't run. It loads up my own admin stuff. Here is my urls.py: (r'^admin/add/member/$', 'astonomyStuff.attendance.views.newMember'), (r'^admin/add/$', 'astonomyStuff.attendance.views.addPage'), (r'^admin/$', 'astonomyStuff....

Django admin search: how to allow OR operator between search terms?

django-sphinx seems to be a bit of an overkill. What's the simplest way to add such functionality? Thanks ...