Currently, I have an issue where within my model I have two ManyToMany fields that basically need to act like tags. I either need my data to go from my HTML to my view so I can populate it in the view function, or just have it work with some special form type.
class MyModel(models.Model): ... skills = models.ManyToManyField(Skill) interests = models.ManyToManyField(Interest) Where Skill and Interest are classes as follows
class Skill(models.Model): SKILLS = ( ('0','Skill 1'), ('1', 'Skill 2'), ) name = models.CharField(max_length=50, choices=SKILLS) def __str__(self): return self.name Currently, my form does not pass in the skill or interest and I can get it to populate off checkboxes. But would like to make it a taggable sort of entry used in Bootstrap: http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/. Any advice is greatly appreciated. Thank you.
https://stackoverflow.com/questions/66524160/django-tag-like-input-for-a-manytomany-field-in-a-model March 08, 2021 at 12:05PM
没有评论:
发表评论