I am developing REST API using django rest framework. Now I want to make a functionality to mark some ads as favorite. Here are some of my ideas:
So, should I keep using ArrayField and try to fix that error? Or creating table with 2 foreignkeys only looks not that bad?
Please, If anyone faced 'form_size' typeerror, help me.
Thank you.
Update 1. Here is favorites field in User table
favorites = ArrayField(
base_field=models.CharField(max_length=50), default=[], blank=True,
)
I am importing these:
````from django.contrib.postgres.fields import ArrayField
UPD 1.
I can suggest 2 methods, but prefer the second one since it's simpler:
- Creating a new Model "Bookmark" is fine, you'll have foreign keys to the USER and AD models, and this will let you add an other attributes (like bookmarked_date, bookmarks tag...)
- Simply adding a ManyToMany attribute "Bookmarks" to the USER Model, this is easy and should be enough in your case