how to "inherit" from django app

581 Views Asked by At

I have written a django app that provides an OpenStreetMap and lets the user interact by adding and removing placemarks. These placemarks have certain properties. The properties are saved in the placemark model.

For another project I'd like to reuse the app, but with different placemark properties. I think the easiest approach would be to just change the placemark model in the app and to change the model to fit my needs.

Is there a more generic way? I could use a placemark class, that has a Meta class with abstract=True. I could then extend the inherited class by adding new fields. But then I'd still need to work with the app directly.

I'd prefer to pass a class with my placemark information to the map-app which then "points" to the placemark information class when information is needed.

Is there a standard django/python way to do this? Are there better approaches?

1

There are 1 best solutions below

0
On

Something similar is going on with the User model in Django. Here it is a setting which model to actually use for User, its called AUTH_USER_MODEL. I suggest you use an MAP_PLACEMARK_MODEL setting, to pass the placement information class to the map-app.