N
N
Nodir Malikov2021-05-08 21:27:05
Django
Nodir Malikov, 2021-05-08 21:27:05

How to override the ManyToMany model field type in Django?

There is a relationship between two tables:

class User(AbstractBaseUser):
    .....
    parks = models.ManyToManyField(to='Parks', related_name='parks_set', blank=True)


Django automatically created a new user_parks table, but the problem is that there can be many users and parks, respectively. How to make ManyToMany table ID be BigInt?

PS I wrote this line in settings.py, but it made BigInt only the IDs of the users and parks tables:

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antonio Solo, 2021-05-09
@solotony

look at the docksthrough

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question