-
-
Notifications
You must be signed in to change notification settings - Fork 352
Open
Labels
Description
All versions of django-smart-selects prior to version 1.2.8 are vulnerable to an XSS attack as detailed in issue 171. As a result, all previous versions have been removed from PyPI to prevent users from installing insecure versions. All users are urged to upgrade as soon as possible.
Checklist
- This issue is not about installing previous versions of django-smart-selects older than 1.2.8. I understand that previous versions are insecure.
- I have verified that that issue exists against the
master
branch of django-smart-selects. - I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- I have debugged the issue to the smart_selects app.
- I have reduced the issue to the simplest possible case.
- I have included all relevant sections of
models.py
,forms.py
, andviews.py
with problems.
Steps to reproduce
Expected behavior
Actual behavior
chained m2m breaks when checkboxmultipleselect widget is introduced. All the objects of the m2m field comes up in the template instead of a filtered list
models.py:
class Examination(models.Model):
name = models.CharField(max_length=20)
class Subject(models.Model):
examination = models.ForeignKey(Examination, on_delete=models.CASCADE)
name = models.CharField(max_length=30)
class UserProfile(models.Model):
user = models.OneToOneField(User)
examination = models.ForeignKey(Examination, blank=True, null=True)
subject = ChainedManyToManyField(
Subject,
chained_field="examination",
chained_model_field="examination",
)
forms.py:
class UserProfileForm(forms.ModelForm):
subject = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple)
class Meta:
model = UserProfile
@blag Please what do you mean by "fill out the template"? it cannot be click; can you expantiate
Edit (by blag): Formatted code with GitHub Flavored Markdown.
Edit 2 (by blag): Edited title to reflect the actual issue.