0

quick question. I'm playing with Django and mysql. So say I have different societies, each with a sign up page, and lets say a user is able to join multiple societies, how can I be able to see in my database, how many/which societies the user is signed up to? (I was thinking maybe if I could use a field in the database that has a list/array datatype. That would be so convenient. But no such datatype exists. Or maybe a textfield and append to it every new society id that a user joins. Not sure.)

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • Hi Grudge, have you got any code for what you have tried so far? – Wayne Lambert Sep 18 '20 at 15:13
  • I suggest you to create Society and User models. Post that code here and we can help you with next steps. – Dmitry Belaventsev Sep 18 '20 at 15:23
  • If you are using a relational database, then pls think about relational database solutions first. Storing a list of values in a field breaks the relational database design. See the answers to the following question for details: https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad – Shadow Sep 18 '20 at 15:45
  • @shadow you're right. I think i'll just settle for a many to many relationship between my society and user models, then if I want to know which societies a user has joined, i'll just perfom a query. – Grudge Banger Sep 19 '20 at 09:58

0 Answers0