django-angular icon indicating copy to clipboard operation
django-angular copied to clipboard

module 'django.forms.forms' has no attribute 'BoundField'

Open GJoshi909 opened this issue 4 years ago • 10 comments

Unable to access certain admin sections with bound forms. Below error shows up when access User page from Django admin.

Request Method: GET
http://10.10.134.239:9005/admin/auth/user/
3.1
AttributeError
module 'django.forms.forms' has no attribute 'BoundField'
/usr/local/lib/python3.6/site-packages/djng/forms/angular_base.py, line 151, in
/usr/bin/python3
3.6.8

/usr/local/lib/python3.6/site-packages/djng/forms/angular_base.py, line 151, in 144. """ 145. context = super(NgWidgetMixin, self).get_context(name, value, attrs) 146. if callable(getattr(self._field, 'update_widget_rendering_context', None)): 147. self._field.update_widget_rendering_context(context) 148. return context 149. 150. 151.class NgBoundField(forms.BoundField): … 152. @property 153. def errors(self): 154. """ 155. Returns a TupleErrorList for this field. This overloaded method adds additional error lists 156. to the errors as detected by the form validator. 157. """

GJoshi909 avatar Sep 03 '20 00:09 GJoshi909

Dont know why, but class "BoundField" is in djano/forms/boundfield.py, but not in django/forms/form.py... so, i changed imports and it works for me...

dselivanovvv avatar Dec 10 '20 13:12 dselivanovvv

They moved it in Django-3.1. Patch is currently prepared.

jrief avatar Dec 10 '20 14:12 jrief

Yes, I have the same issue. Let us know once the patch is available, thanks.

grouser avatar Jan 08 '21 13:01 grouser

Sorry, please retest with the latest version from GitHub. I'm currently preparing a new version for it

jrief avatar Jan 08 '21 14:01 jrief

@jrief Any update on a release to include this move? It looks like you handled django 3.1 compatibility a year ago, but there isn't a release for it.

AgDude avatar Jan 20 '22 13:01 AgDude

@AgDude Please have a look at my follow up project https://github.com/jrief/django-formset

It will replace django-angular, since AngularJS is not maintained anymore. In django-formset I reimplemented the complete form validation in pure TypeScript – no external dependencies (except dev tools of course).

Since you are a long time user of django-angular, we can meet for an online session, so that we can talk about the current migration possibilities.

jrief avatar Jan 20 '22 14:01 jrief

@jrief Thanks for the response. Your new project looks like a really nice approach! I completely agree it is long past time to move away from angular.js. I have mostly moved away from using django forms in my newer applications and use django to build an api. Right now I am looking for the least-resistance means to get a large legacy application onto Django 3.2 LTS. I haven't been through all of the verification yet, I have our unit tests passing using an install of django-angular from git, but I would prefer to get it from pypi.

AgDude avatar Jan 20 '22 21:01 AgDude

If you want to take over that project, you're welcomed. I don't want to spend more time riding a dead horse.

jrief avatar Jan 21 '22 00:01 jrief

Thanks but no thanks. I suggest you archive the github repo that that the few of us still using it know there won't be any more releases. You are completely justified in not putting more time into this project. I appreciate the time you did put into it. It worked really nicely for some projects of mine when angular.js was at its peak.

AgDude avatar Jan 21 '22 20:01 AgDude

Anyway, using this library in many of my projects, really helped me to understand how to handle form validation in a DRY manner. In django-formset I reused many of those ideas, so users of django-angular will have a similar user experience.

But this time I did not want to rely on any JS-framework. Although I believe, that django-formset can run with most of the modern ones.

jrief avatar Jan 21 '22 22:01 jrief