Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions django/db/models/fields/related_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class Child(Model):
from django.db.models import Q, signals
from django.db.models.query import QuerySet
from django.utils.functional import cached_property
import logging

logger = logging.getLogger(__name__)


class ForwardManyToOneDescriptor:
Expand Down Expand Up @@ -531,11 +534,16 @@ def _get_set_deprecation_msg_params(self):
'reverse side of a related set',
self.rel.get_accessor_name(),
)

#TODO: This is for debugging purpose and will be removed later after patching m2m field assignment issue
def __set__(self, instance, value):
raise TypeError(
'Direct assignment to the %s is prohibited. Use %s.set() instead.'
% self._get_set_deprecation_msg_params(),
# raise TypeError(
# 'Direct assignment to the %s is prohibited. Use %s.set() instead.'
# % self._get_set_deprecation_msg_params(),
# )
logger.warning(
"Direct assignment to the %s is prohibited. Use %s.set() instead for the instance {0} and msg params:{1}".format(
instance,self._get_set_deprecation_msg_params()
)
)


Expand Down
2 changes: 1 addition & 1 deletion django/forms/boundfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def as_widget(self, widget=None, attrs=None, only_initial=False):
name=self.html_initial_name if only_initial else self.html_name,
value=self.value(),
attrs=attrs,
renderer=self.form.renderer,
# renderer=self.form.renderer,
)

def as_text(self, attrs=None, **kwargs):
Expand Down