Nobody knows ?
On Jul 29, 6:12 pm, Fleg <francois.legr...@gmail.com> wrote:
> Hi,
> I have a model mapping tables in a database with several foreign keys.
>
> class Scheduler(models.Model):
> id_schedule = models.AutoField(primary_key=True)
> id_parent = models.ForeignKey
> ("Scheduler",db_column='id_parent',to_field='id_schedule')
> id_object_type = models.ForeignKey(ObjectTypes,
> db_column='id_object_type',to_field='id_object_type')
> id_action = models.ForeignKey(Actions,
> db_column='id_action',to_field='id_action')
> id_status = models.ForeignKey(Status,
> db_column='id_status',to_field='id_status')
> id_release = models.ForeignKey(Releases,
> db_column='id_release',to_field='id_release')
> id_object = models.IntegerField()
> begin_execute = models.DateTimeField(null=True,blank=True)
> end_execute = models.DateTimeField(null=True,blank=True)
> pid = models.IntegerField()
>
> I am working with an instance of this model and at some point I need
> to reload it's attributes from the database.
> I couldn't find a correct way to do it. Can somebody help me ?
>
> PS: I tryed to write a "reload" method like this:
> def __reload__(self):
> self.__init__(**Scheduler.objects.filter
> (id_schedule=self.id_schedule).values()[0])
>
> but unfortunately, it updates only the keys but not the objects
> associated with the foreign keys !
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---