Extracting the database name from an object

2011-09-27 Thread Juan Pablo Romero Méndez
Hello, Suppose I get an object from a non-default database: ob = MyModel.objects.using('somedb').get(pk=1) Is it possible later to retrieve the database name just from the object? ob.db?? Regards, Juan Pablo -- You received this message because you are subscribed to the Google Groups

Re: template list empty in with django test client

2011-08-28 Thread Juan Pablo Romero Méndez
My fault. I was testing from the console. Within an actual test the request does have the templates. Juan Pablo El día 28 de agosto de 2011 17:50, Juan Pablo Romero Méndez <jpablo.rom...@gmail.com> escribió: > Hello, > > I'm using the django test client, like this: > >&g

template list empty in with django test client

2011-08-28 Thread Juan Pablo Romero Méndez
Hello, I'm using the django test client, like this: >>> c = Client() >>> r = c.get("/content/new/") >>> r.status_code 200 >>> r.templates [] Is this normal? Regards, Juan Pablo -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Tutorial: New class based generic views

2011-08-09 Thread Juan Pablo Romero Méndez
Thanks for the feedback Gelonida! 2011/8/9 Gelonida N <gelon...@gmail.com>: > On 08/09/2011 03:33 PM, Juan Pablo Romero Méndez wrote: >> Hey guys, >> >> This is the first part of a series of blog posts I'm writing about >> class based generic views: >> >

Tutorial: New class based generic views

2011-08-09 Thread Juan Pablo Romero Méndez
Hey guys, This is the first part of a series of blog posts I'm writing about class based generic views: http://pseudocorta.blogspot.com/2011/08/django-generic-views.html Cheers! Juan Pablo -- You received this message because you are subscribed to the Google Groups "Django users" group.

Prototype: LINQ-esque Manager for Django models

2011-06-05 Thread Juan Pablo Romero Méndez
Hello, I've just put a very rough prototype of a db.models.Manager that allows queries to be specified with lambdas: Choice.objects.where(lambda c: c.votes >= 1) Choice.objects.where(lambda c: c.votes != 1) Choice.objects.where(lambda c: c.poll.question.exact('aaa')) Choice.objects.where(lambda

django admin and static files

2011-05-11 Thread Juan Pablo Romero Méndez
Hello, I'm trying to use a custom javascript file in the admin app with Media: class MyAdmin(admin.ModelAdmin): class Media: js = ('js/my.js',) the problem is that after installing the staticfiles app (in INSTALLED_APPS) and after setting STATIC_URL = '/media/', the admin app is

Re: Question about ModelAdmin.formfield_for_foreignkey

2011-05-05 Thread Juan Pablo Romero Méndez
I think i solved it. This is the chain of method calls of admin.ModelAdmin: ... change_view get_form formfield_for_foreignkey ... get_form receives the current object as parameter, so all I had to do was to inject obj in the request: def get_form(self, request, obj=None, **kwargs):

Question about ModelAdmin.formfield_for_foreignkey

2011-05-05 Thread Juan Pablo Romero Méndez
Hello, Is it possible to obtain a reference to the modified object in ModelAdmin.formfield_for_foreignkey? Thanks! Juan Pablo -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Select list populated from an object method (admin app)

2011-05-03 Thread Juan Pablo Romero Méndez
Ok, I learned about ModelAdmin.formfield_for_foreignkey, which let's me access the current user. What I can't find now is the instance asociated the db_field parameter. El 3 de mayo de 2011 14:19, Juan Pablo Romero Méndez < jpablo.rom...@gmail.com> escribió: > Hello, > > I wo

Select list populated from an object method (admin app)

2011-05-03 Thread Juan Pablo Romero Méndez
Hello, I wonder if there's an easy way to do the following (besides modifying "contrib.admin.templates.admin.includes.fieldset.html"): I have a model which uses django-workflows, so for each instance and every user I can do: get_allowed_transitions(obj,user), and obtain a list of Transition

Re: Django Admin template

2011-05-03 Thread Juan Pablo Romero Méndez
For this, django-google-toolbar is invaluable. It tells you exactly which templates were used in rendering some url. Coupled with pycharm's "find file by name" feature (Ctrl+Shift+N) it names really easy to jump to any name file. Regards, Juan Pablo 2011/5/3 Rich >

Using different choices in different ModelAdmins

2011-04-25 Thread Juan Pablo Romero Méndez
Hello, I'm developing several personalized admin sites (by subclassing admin.ModelAdmin). Is it possible to use different Field.choices in a particular field for each admin site? The problem is that the choices option is set within the model definition, not in the ModelAdmin. Regards, Juan

Unidirectional relations

2011-04-19 Thread Juan Pablo Romero Méndez
Hello, Is it possible to create unidirectional relations within django's orm? What I mean is a situation where a parent has a children_set of references to children, but the children don't have any reference to the father. Regards, Juan Pablo -- You received this message because you are

Sitio que estamos lanzando

2009-09-23 Thread Juan Pablo Romero Méndez
Chequen este sitio web que estamos lanzando, a ver que les parece: http://www.quetanprincipeeres.com.mx/ Saludos, Juan Pablo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: I need to get psycopg2 installed on Mac OS X 10.5

2009-07-15 Thread Juan Pablo Romero Méndez
I remember that there were some issues, but unfortunately I didn't document how I resolved them :( Juan Pablo 2009/7/14 Kevin <hekevint...@gmail.com>: > > Thanks a lot Juan!  It works fine on my machine.  Would you be able to > share your compilation steps? > > On Jul 14

Re: Django way to design this model

2009-07-08 Thread Juan Pablo Romero Méndez
Mhh... I don't fully understand your question. Regarding the radio buttons I think it is in the tutorial. What search fields are you talking about? Juan Pablo 2009/7/8 Divesh Gidwani : > > Hey, > > Newbie to Django, and have just finished part 2 of the tutorial on the >