Re: Extending the method that is called the first time a model is deployed.

2008-06-22 Thread James Bennett

On Sun, Jun 22, 2008 at 4:41 AM, mwebs <[EMAIL PROTECTED]> wrote:
> It seems as if these signals have to be used in management.py, but
> what I need is something I can use directly in my model code.
> Something like overloading a method. The fact that this should be
> happen in the model-class is very important. E.g I dont want every
> model to be registerd in my "meta-model" Apps only some of my models.

I think you've misunderstood how signals work; you can selectively do
something only when a certain specific class is first loaded.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending the method that is called the first time a model is deployed.

2008-06-22 Thread mwebs

Hi,

It seems as if these signals have to be used in management.py, but
what I need is something I can use directly in my model code.
Something like overloading a method. The fact that this should be
happen in the model-class is very important. E.g I dont want every
model to be registerd in my "meta-model" Apps only some of my models.

One Idea was to implement this kind of registration everytime a model
is instantiated and checking if there is already an entry. But this a
hack because I really need this only one time (the first time the
model is deployed.)

any ideas?

Thanks, Toni

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending the method that is called the first time a model is deployed.

2008-06-21 Thread Alex Koshelev

try `class_prepared` or `post_syncdb` signals

On Jun 21, 3:43 pm, mwebs <[EMAIL PROTECTED]> wrote:
> I want to register a specific model(not an object of the model, the
> model itself) in another model.
> This should be done the first time the model is deployed with syncdb.
>
> So what I need is the function that is called the first time a model
> is deployed, so that I can extend this function and register the model
> in my App-Model:
> pseudoCode:
>
> class Category(models.Model)
>      .
>      def __deploy__():
>           super(self, Category).__deploy__()
>           app = App(object_name = self.__class__.name)
>           app.save()
>
> Has anyone an idea which method is used for deploying a model?
>
> Thank you, Toni
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Extending the method that is called the first time a model is deployed.

2008-06-21 Thread mwebs

I want to register a specific model(not an object of the model, the
model itself) in another model.
This should be done the first time the model is deployed with syncdb.

So what I need is the function that is called the first time a model
is deployed, so that I can extend this function and register the model
in my App-Model:
pseudoCode:

class Category(models.Model)
 .
 def __deploy__():
  super(self, Category).__deploy__()
  app = App(object_name = self.__class__.name)
  app.save()


Has anyone an idea which method is used for deploying a model?


Thank you, Toni
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---