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

Widget for ForeignKey to tag

Open thenewguy opened this issue 4 years ago • 3 comments

It is sometimes necessary to include metadata about particular tags - i.e. for filtering purposes like required, optional, excluded, etc. In this case, you need to create a ForeignKey to the tag for the metadata model.

Since there are usually lots of tags, the default dropdown widget can't be used. That leaves us having to use a raw id type widget and requiring the user to input the tag pk.

As this isn't very user friendly, it would be nice if there was a single tag widget that took the tag name from the user and returned an appropriate value for the ForiegnKey field. It would be awesome if it also hooked up to the frontend tag autocomplete.

thenewguy avatar Feb 25 '21 15:02 thenewguy

I'd love to cut my teeth on a little project like this with you. Where would we start?

pyrodney avatar Mar 10 '21 15:03 pyrodney

Great! We would want a widget that takes a tag name and returns a tag model instance. We should start there. Most of the logic should already be available - for example, we can use the parse tags function for validating the string and ensuring there is only one tag.

Hooking up the autocomplete should be simple from that point.

thenewguy avatar Mar 10 '21 17:03 thenewguy

I hope you can be patient with me. I am new to contributing to other projects. I hope you can walk me through this more gently.

  1. Which file would this "widget that takes a tag name and returns a tag model instance" go?
  2. Do I have to make a pull request to work on this?

I hope you wouldn't mind walking me through a procedure like this so I can get the hang of this.

Thanks!

pyrodney avatar Mar 16 '21 23:03 pyrodney