asifpy / django-crudbuilder

Generic CRUD implementation in Django
https://django-crudbuilder.readthedocs.org/en/latest/index.html
Apache License 2.0
193 stars 67 forks source link

Dont create views when define view in other app #8

Closed marcoshemann closed 8 years ago

marcoshemann commented 8 years ago

I have this same structure cadastro/models.py /forms.py /views.py (here i define some view (BaseCrudBuilder): and work well /urls.py ( here is url(r'^', include('crudbuilder.urls')),) but if a create a view (BaseCrudBuilder): in other app like

perfil/view.py

class ProxyCrud(BaseCrudBuilder): model = Proxy search_feilds = ['nome'] tables2_fields = ('nome')

It dont create urls.. like /perfil/proxies...

If i create a same class ProxyCrud(BaseCrudBuilder): in cadastro.view show me a error:

crudbuilder.exceptions.AlreadyRegistered: Key 'zabbix-drule' has already been registered.

asifpy commented 8 years ago

Error is saying that, drule model of zabbix app has already been registered, which means Drule model is registered twice somehow.

Also please note that you need to place url(r'^', include('crudbuilder.urls')),) in your root urls.py (where manage.py exist) and place your ModelCrud classes in your_app/crud.py (perfil/crud.py ---> for Proxy model, zabbix/crud.py ---> for Drule model).

marcoshemann commented 8 years ago

Yes, organizing this way works very well. I use Python 3, and put url inside of app that have settings.py. Thanks.

asifpy commented 8 years ago

yeah you are right main urls.py should be in same level as that of settings.py. In above I mentioned it wrongly (I said manage.py instead of settings.py)