znc-sistemas / childcrud Goto Github PK
View Code? Open in Web Editor NEWAjax utilities to parent - child models
Ajax utilities to parent - child models
Converter variável model_name para lower case na view
Adicionar exceção quando o exclude não estiver definido
if hasattr(self.form, '_meta'):
exclude_fields = list(self.form._meta.exclude)
else:
exclude_fields = []
problemas com childcrud e municipios:
python 3.5
django 1.9
from views.py import ajax_create_update, ajax_list, fk_create_update
ImportError: No module named 'views'
solução:
from childcrud.views import ajax_create_update, ajax_list, fk_create_update
-------------
File "/home/fabiano/ENVS/escolar/src/childcrud/childcrud/views.py", line 7, in <module>
from django.db.models import get_model, DateField, DateTimeField, BooleanField
ImportError: cannot import name 'get_model'
**
django.db.models.loading.get_models will be removed in Django 1.9 #33
solução:
from django.apps import apps
apps.get_model('shop', 'Product')
-----------------
src/childcrud/childcrud/urls.py:14: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
url(r'(?P<app_name>\w+)/(?P<model_name>\w+)/$', fk_create_update, name='fk-create')
solução:
try:
from django.conf.urls import url
except:
from django.conf.urls.defaults import patterns, url
from municipios.views import (
base_url_js,
base_url_js,
municipios_ajax,
teste,
)
urlpatterns = [
'municipios.views',
url(r'^$', base_url_js, name='municipios-base-url'),
url(r'^base_url.js$', base_url_js, name='municipios-base-url-js'),
url(r'^ajax/municipios/(?P<uf>\w\w)/$', municipios_ajax, name='municipios-ajax'),
url(r'^teste/', teste, name='municipios-teste'),
]
---------------
from municipios.views import (
File "/home/fabiano/ENVS/escolar/lib/python3.5/site-packages/municipios/views.py", line 7, in <module>
from forms import FormMunicipio
ImportError: No module named 'forms'
solução:
from municipios.forms import FormMunicipio
-------------------------------
File "/home/fabiano/ENVS/escolar/lib/python3.5/site-packages/municipios/forms.py", line 4, in <module>
from widgets import SelectMunicipioWidget
ImportError: No module named 'widgets'
solução:
from municipios.widgets import SelectMunicipioWidget
-------------------------------
/lib/python3.5/site-packages/municipios/views.py", line 8, in <module>
from models import Municipio
solução:
from municipios.models import Municipio
---------------------
AttributeError: 'str' object has no attribute 'regex'
http://stackoverflow.com/questions/36288146/django-1-9-url-include-attributeerror-str-object-has-no-attribute-regex
childcrud.urls
estava:
urlpatterns = [
' ', <--- esse era o problema
url ...
http://stackoverflow.com/questions/35551720/django-how-to-work-with-ugly-url (similar)
-------------
invalid syntax (childcrud.py, line 78)
src/childcrud/childcrud/templatetags/childcrud.py", line 79
raise template.TemplateSyntaxError, "tag requires exactly three arguments" # % token.contents.split()[0]
def childcrud_html(parser, token):
try:
# split_contents() knows not to split quoted strings.
tag_name, parent, parent_id, child = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError, %r tag requires exactly three arguments" % token.contents.split()[0]
return ChildCRUDHTMLNode(parent, parent_id, child)
solução:
msg = "%r tag requires exactly three arguments" % token.contents.split()[0]
raise template.TemplateSyntaxError(msg)
???
-------------
childcrud.py
deprecated:#from django.db.models import get_model
trocar get_model from django.db.models import get_model
por from django.apps import apps
usar apps.get_model
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.