When you say: "create an instance and save it to db later", is that dynamic?
On Tuesday, October 22, 2019 at 11:26:19 PM UTC-4, WD Wang wrote: > > hi, > > A user could have many roles, it's all depends on your design. My > understanding is: > 1. When user directly sign up, he will be assigned the primary role. > 2. When user sign up by an invitation, he will be assigned the member role. > 3. So can a user in member role invite other users? > > The 'save()' method you mentioned is the 'save' method for django models? > You can simply use model class to create an instance and save it to db > later. > > u = User(name='Lucy') > u.save() > > Maybe you can check the docs here > https://docs.djangoproject.com/en/2.2/topics/db/models/ . > > On Wed, Oct 23, 2019 at 9:37 AM Stephanie Semerville < > [email protected] <javascript:>> wrote: > >> I am new to Django and trying to create a website that has two user roles >> primary and member. What i would like to happen is for by default a primary >> user to sign up and be assigned the primary role. When that primary user >> logs into the website, I would like them to have the ability to invite new >> users to the website. When that new user receives the invitation email and >> is redirected to the same sign up form, I would like that user to be auto >> assigned the member role on form submit. I have heard about the save() >> method but not sure how to use it and what file it goes in. Would the >> process change if all users can potentially be both roles? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/271b7fdf-cc8c-4408-b539-9902ff526db1%40googlegroups.com.

