Let me provide more details. When I make simple python project with the same idea, everything works fine.
# file test2.py class A: b = 2 # file test1.py from test2 import * class A(A): a = 1 # file test.py from test1 import * a = A() print a.b, a.a print A.__module__ The output is 2 1 test1 So class A is imported from test2 to test1, then overloaded (actually extended) there, then imported to test, cool. When I do the same in django, everything goes wrong. I do import models_auto in models_business_logic, then overload the Company class, then import it in models, then import models in admin file and try print Company.__module__ And this gives me the dbadm.models_auto output On Oct 6, 4:10 pm, Eugene Mirotin <emiro...@gmail.com> wrote: > We have an existing app written in perl with Postgre as DB. > I want to add the django admin as the interface to this existing DB. > The main app is in constant development, so the DB scheme may change > in the future. > I have checked the inspectdb output and it is quite good (I do also do > some automatic fixing of the results of inspectdb, but these fixes are > minor). > So, if we would only want to have the 'dumb' db editing tool, the > auto-generated models are OK. > But what we really want is adding some additional logic (such as > __unicode__ representations and save validations). Of course, it is > unacceptable to have this code in the auto-generated file, not is is > good to always manually insert it after every db scheme update (the > models file generated by inspectdb is 1000+ lines long). > > What I have tried looked like > - have the models_auto.py file - the inspectdb patched output > - have the models_business_logic.py module looking like > > from models_auto import * > > Company_ = Company > del Company > > class Company(Company_): > def __unicode__(self): > return '%s [%s]' % (self.nick, self.legal_name) > > - have the models.py file simpli importing * from models_business_logic > > But dues to inheritance mechanism and Foreign keys (or may be dues to > some other reasons) this approach do not work. > Any ideas? > > Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---