testing a model that uses stored procedures

2011-05-07 Thread Viktor Kojouharov
Hello, I have a model that uses a stored procedure + a column outside of django's control for specialized selects. My problem is that I don't see a good way of testing my related python code for that model. Since I need to execute some SQL code at the beginning of each test, right after the

Explicitly telling django that the reverse OneToOne relationship doesn't exist

2011-03-14 Thread Viktor Kojouharov
Hello, I have a database function that returns the necessary data for constructing a bunch of related objects in one go. One of the objects has a OneToOne relationship with my main model instance, and it doesn't exists for every object of the main model. Since the main model has a reverse

Handling readonly fields in the admin, which are provided by the form

2011-02-22 Thread Viktor Kojouharov
Hello, I'm having a bit of a problem providing a custom readonly field, which is defined in the form. The field is defined in the form, as such: class Form(forms.modelForm): field = myCustomField() The field is also associated with a custom widget, which is set in the form's __init__. it is

Inlining a reverse foreign key relationship in django admin

2011-01-12 Thread Viktor Kojouharov
Hi, Consider the following models: class Foo(models.Model): name = models.CharField(max_length=100) class Bar(models.Model): name = models.CharField(max_length=100) city = models.ForeignKey(Foo) How can I inline the admin model form for Foo into Bar, so that I can add new Foo items

Getting model instances from cursor fetches

2010-12-30 Thread Viktor Kojouharov
Hello, I have a stored procedure which creates a cursor for a query, and also returns the total count for the (unlimited) query. The query itself can be mapped to my model if ran through the raw method of the manager. However, I'm interested in using the procedure, rather than 2 separate

can't pickle Input objects -- error in django 1.3 beta 1 with memcached cache backend

2010-12-27 Thread Viktor Kojouharov
Hi, With django 1.3 alpha 1, I was using the following piece of code in my urls.py without a problem: cache_page(views.IndexView.as_view(), timeout) When upgrading to 1.3 beta 1, I got this error: Environment: Request Method: GET Request URL: http://localhost:8000/bg/ Django Version: 1.3