The newforms module isn't tied to the models, but you can easily
create a form from a model using the helper function from_from_model.
So in your view:
from django import newforms
from models import YourModel
def some_view(request):
form_class = newforms.form_from_model(YourModel)
#Modify t
Oliver,
form['fieldname'] returns a Field class object. To add an error to
that you want to do form.errors['fieldname'] = ['Your list of errors
messages'].
If you also want to preserve other possible errors you'll want to us
form.errors.setdefault('fieldname', []).append('Your error here.')
ins
As a comparison I have to say that Wing IDE has a very nice Python
debugger (fast and it works). I haven't used Komodo in a while but I
remember my biggest issue with it was that its debugger stopped at
exceptions that truely were handled, and that it was slow.
For django I set my manage.py file
(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': 'path/to/document/root/media', 'show_indexes':
True}),
As a temporary measure you can add a line like this to your urls.py in
order to serve media when developing, replacing the path line with an
absolute path to your media. Idea
4 matches
Mail list logo