Converting existing python classes into Django Models -


i have small program command line interface uses number of python classes thorough implementations. want scrap command line interface , wrap app within django app, i'm learning django , i'm unfamiliar conventions.

i have number of classes, in-memory storage structures, getters/setters etc , i'd convert them django models can persist them database , interact them around django app. there general approach doing this?

should inherit django.db.models.model class in existing classes , set them direct interaction? or there better, more general/conventional way this?

i able use of code in other apps, not necesarilly django ones, don't want modify existing classes in way make them work django. thought of creating models separately , sort of middle-man class manage interaction of actual in-memory class django model class, seems more places have make changes when extend/modify code.

thanks ahead of time...

personally, modify existing classes extend models.model , maintain separate versions of these classes use outside of django.

this keep classes lean , maintainable within respective environments.

you create new class extends both models.model , python model through multiple inheritance. result in duplicate fields same data.

if like, post example model new question , tag me in link here, , can convert it.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -