Hi everyone,

Would it be possible to provide a new inheritance mechanism between classes 
in Django ?

I explain my point :

I have an app, for instance "HR": In this app, I would manage a model that 
is called "Employee". I store several information on this model and it's 
fine.

Suppose I have a SECOND app, for instance "Fleet". In this app, I would 
manage a model that is called "Vehicle" and of course I store several 
information on this model.

Suppose I only use the app "HR"  and one day, I decide to use the app 
"Fleet". That's okey, no problem. Both will work.

But what if I decide to create a THIRD app, for instance "HR-Fleet" that 
does the bridge between the two others ?

That means that HR can be used ALONE and same for Fleet.

But HR-Fleet would add additional information. For instance, on the 
employee we would add a field "company_car" that points to a vehicle. The 
trick is, it would be GREAT to be able to do that without creating 
additional table in the database.

Here is a sample of code to illustrate the behavior I'm trying to explain :

In app "HR" :

hr/employee.py :

class Employee(models.model):
   name = ...
   email = ...

In app "Fleet" :

fleet/vehicle.py

class Vehicle(models.model):
   brand = ...
   model = ...
   fuel_type = ...

In app "HR-Fleet" :

hr_fleet/employee.py :

class HRFleetEmployee(models.model):
   _inherit = <path_to_employee_model>

   company_car = models.ForeignKey(...)


And that would add an extra field on the Employee model without adding any 
table in the database or using proxy model or ...

Can you guys tell me if that behavior is possible ?

If you don't get the point of such a functionnality, I can try to give more 
details or be more clear.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7800872b-6191-4505-b3bb-f726b0b92db3%40googlegroups.com.

Reply via email to