Ignoring fields in deserialization

2010-07-08 Thread lfrodrigues
Hello, I had some copies of a model with 10 fields serialized in a file. I deleted some of the fields (since I don't need them anymore) now I can't deserialize the model. error: raise FieldDoesNotExist, '%s has no field named %r' % (self.object_name, name) Any help, please. Luis -- You recei

Accessing foreign key related item

2009-12-08 Thread lfrodrigues
I have this structure: class Album(models.Model): caption = models.CharField(max_length=500) def get_album_type(self): if self.a_set.count() > 0: return 'a' if self.b_set.count() > 0: return 'b' def _get_a(self): return self.a_set.all()[0] def _get_b(self):

Re: Model inheritance - filtering base model only

2009-11-23 Thread lfrodrigues
s__ of the model, but seems one can > manually filter it afterwords: > > qs = Player.objects.all() > for i,obj in enumerate(qs): >     if obj.__class__ != Player: >         del(qs[i]) > > On Nov 22, 4:32 pm, lfrodrigues wrote: > > > Hello, > >

Model inheritance - filtering base model only

2009-11-22 Thread lfrodrigues
Hello, I have these models: class Player(models.Model): . class PlayerM(Player): ... If I do PlayerM.objects.all() e get all PlayerM objects and for Player.objects.all() I get all Player and PlayerM as expected. How can get only the objects of type Player (only retrieve the objects

Object Edition Moderation

2009-11-16 Thread lfrodrigues
Hello, I've been using admin to create/change some objects in my company. Now I have a new set of users that will be able to change objects but a moderator needs to approve the changes. Do you have any suggestion on how to implement this? Best regards, Luis -- You received this message becaus

Saving Oracle Connection across requests

2009-09-14 Thread lfrodrigues
Hello, I'm not sure this is possible but I would to save a oracle connection across several requests (like I do with a normal object) I would like to: if 'object' in request.session: do stuff else: import cx_Oracle conn = cx_Oracle.connect(constring) request.session['object'] = conn do stu

django deploy problem

2009-09-11 Thread lfrodrigues
Hi, I want to deploy 2 django sites in different subdirectories so I have: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE admin.settings PythonDebug On PythonOption django.root /admin SetHandler

Re: Django aggregates and having

2009-08-11 Thread lfrodrigues
the only similar query I managed to make using the ORM. On Aug 12, 3:44 am, Russell Keith-Magee wrote: > On Wed, Aug 12, 2009 at 5:50 AM, lfrodrigues wrote: > > > Hi, > > > I'm having some problems with "having": > > > I want to group by date and re

Django aggregates and having

2009-08-11 Thread lfrodrigues
Hi, I'm having some problems with "having": I want to group by date and restrict to a given week, in my tests I can do this: select_data = {"d": """date_format(date, '%%U')"""} ScoreHistory.objects.extra(select=select_data).values('d').annotate (l=Sum("points")).filter(l=2).query.as_sql() sql:

Using django.root in mod_python

2009-08-10 Thread lfrodrigues
Hello, All my previous projects I've deployed them on the root of a web address. Now I have to deploy two in the same address eg: http://myserver.com/proj1 http://myserver.com/proj2 I'm using django.root to set the correct root (with works fine). I just have two questions: 1 - all the media are

Multiple Logins

2009-08-04 Thread lfrodrigues
Hi, I've developed a special Auth backend for a internal communication protocol. Everything was ok but now the requirements changed and I need to allow on the same browser (in diferent tabs) several logged users. How can I have (in the same browser process) several logged users at the same time?

Re: UserProfile and select_related

2009-08-03 Thread lfrodrigues
Isn't there any way to cache profile data on User side? When are you planning on closing 7270? A lot of my code uses get_profile in templates and that is always a query. Isn't it possible to optimize this? On Aug 3, 3:45 pm, lfrodrigues wrote: > Ok  Thanks > > On Aug 3

Re: UserProfile and select_related

2009-08-03 Thread lfrodrigues
Ok Thanks On Aug 3, 12:12 pm, Malcolm Tredinnick wrote: > On Mon, 2009-08-03 at 02:48 -0700, alant...@neei.uevora.pt wrote: > > Hello, > > > I'm displaying lot of user profile picture with are on a user profile > > (i'm using contrib.auth). So for each picture I have a query for the > > user pr