caching static/domain tables

2011-03-11 Thread Cesar Devera
I have in my models, some tables that hold static information, like status codes, types and descriptions, for example: in models.py: class CustomerStatus(models.Model): name = models.CharField() class CustomerType(models.Model): name = models.CharField() class Customer(models.Model):

django accounts/login page looping

2010-10-05 Thread Cesar Devera
hi, I'm using django' standard auth system, and decorating my views with @user_passes_test(lambda u: u.is_staff) or something alike. everything works fine 99% of the time, but sometimes, one day when I get back to my application, I go to the login page, type my correct username and correct passwo

Re: Simplification of a DB "query"

2010-06-11 Thread Cesar Devera
I'm not sure how to do directly in Django ORM, but if you use plain SQL queries, you could do try: select * from conference_room cr1 where cr1.start_time >= (select max(start_time) from conference_room cr2 where cr2.start_time < :yout_filter_time) and cr1.start_time < :your_filter_time

how to inline formsets dynamically (key points)

2010-04-20 Thread Cesar Devera
hi. I'm working with inline formsets, and I plan to add them dynamically in my application. I did some tests and I found the following key points to handle: 1. my html must contain two hidden fields, named: myinlineformsetname_set-TOTAL_FORMS myinlineformsetname_set-INITIAL_FORMS 2. each new fo

Re: pure Django master/detail forms?

2010-04-06 Thread Cesar Devera
it seems that inline-formsets will do the job. something related to models.BaseInlineFormSet and models.inlineformset_factory. http://code.google.com/p/django-dynamic-formset/ I'm still studying the code. :P regards. - On 6 abr, 16:09, Cesar Devera wrote: > hi. imagine f

pure Django master/detail forms?

2010-04-06 Thread Cesar Devera
hi. imagine following scenario: #-- from django.db import models from django.forms.models import ModelForm # ignore this Sample for now. focus on Master and Detail class Sample(models.Model): foo = CharField() class Master(models.Mo

change modelform values after POST

2010-03-21 Thread Cesar Devera
hi. I have a ModelForm based on an Model like this: class MyModel(models.Model): attr1 = models.CharField() attr2 = models.CharField() attr3 = models.CharField() createdby = models.ForeignKey(User, related_name='createdby', db_column='createdbyid') calculatedfield = models.CharField()