0

I want to upgrade my todolist app so that users can create a link to their own todolist. for example, they can do 127.0.0.1/room/testroom and it'll take them to a todo list. Another use can do 127.0.0.1/room/testroom2 will take them to a new room with another instance of the todo list. I'm not sure how to implement this feature. I already have one app set up for the main todo app functionality. I'm in the progress of writing the ROOMS app which will let users create rooms. I don't know how to mix both models from different apps, or should I put them all in the same app?

Steve
  • 63
  • 3
  • 7
  • I’m not sure. Do you think I should have created a new app for the functionality? – Steve Jul 13 '21 at 07:20
  • Are the components tightly coupled? Or are they mostly independent? (IE: are you creating new things of all types, or just new todo lists?) One app is simpler. But this question is hard to answer without more info. You might be better off just asking how to access models from another app. – Ezra Jul 13 '21 at 07:22
  • Yeah im doing that. I just need to attach the todo database to each new room Code – Steve Jul 13 '21 at 08:11
  • @Steve How does you `urlpatterns` look? For instance, do you have a pattern like `path(room//, your_view_name)` ? With that you can retrieve data in dependence of the parameter `room`. You can use models across different apps. I recommend using one app. For me, it is a `todolist`-app and you would like to specify your todos with rooms. Maybe a `OneToMany` relationship can help you. One room provides todos. You can retrieve your data like e.g. `Room.objects.get(pk=room).todo_set` – Klim Bim Jul 13 '21 at 08:19
  • Are you sure it’s a one to many? Each room have 1 todo. Why not One To One? – Steve Jul 13 '21 at 15:19

0 Answers0