I'm trying to separate my models from my proxies in order to maintain the 
functionality more easily. The point is that, as my models.py started to 
grow over and over, I decided to create a new file in each app (proxies.py) 
where I'd define my proxies. I used to work like this:

# models.py

class MyModel(models.Model):
    prop1 = ...
    prop2 = ...

    def f1(self):
        pass
    def f2(self):
        pass


However, I wanted to have this structure:

# models.py

class MyModel(models.Model):
    prop1 = ...
    prop2 = ...

# proxies.py

from myapp import models


class MyModel(models.MyModel):

    def f1(self):
        pass
    def f2(self):
        pass

    class Meta:
        proxy = True

But, when I tried to make some tests:

$ python manage.py shell
Python 2.7.3 (default, Apr 20 2012, 22:44:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from myapp.proxies import MyModel
>>> MyModel
<class 'MyProject.myapp.models.MyModel'>

So, when I ask for the proxy it gives me the model in models.py. And, of 
course, it keeps the properties defined on the model but lacks all of the 
methods in the proxy. Could anybody please tell me WTF is going on here?

Thanks for your help :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/gBXn2pb3OTQJ.
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.

Reply via email to