Re: Auto assigning 2 types of user roles on sign up

2019-10-23 Thread Nazish Akhtar
Initially you will have to create Role object and then assign it to user. 
and you add new roles whenever you want by editing Role model

On Wednesday, 23 October 2019 21:44:10 UTC+5:30, Stephanie Semerville wrote:
>
> 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 <
>> stephanie...@gmail.com> 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 django...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/db86a016-27ae-43d0-aa17-1e5f05c25c89%40googlegroups.com.


Re: Auto assigning 2 types of user roles on sign up

2019-10-23 Thread Stephanie Semerville
Understood but what is the snippet o code that specifies the role that i 
would like to assign to invited user?

On Wednesday, October 23, 2019 at 12:43:44 PM UTC-4, Jani Tiainen wrote:
>
> Hi.
>
> Personally I would do it as follows:
>
> On invitation create invited user account at least with email and with 
> member role. Make account disabled. You might also add invitation key which 
> you can put in email and check as well.
>
> When invited user starts sign up procedure you can just fill in the blanks 
> and enable account.
>
>
> ke 23. lokak. 2019 klo 4.38 Stephanie Semerville  > kirjoitti:
>
>> 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 django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/897ae838-be67-45e2-92df-ae2c9b21c0f3%40googlegroups.com.


Re: Auto assigning 2 types of user roles on sign up

2019-10-23 Thread Jani Tiainen
Hi.

Personally I would do it as follows:

On invitation create invited user account at least with email and with
member role. Make account disabled. You might also add invitation key which
you can put in email and check as well.

When invited user starts sign up procedure you can just fill in the blanks
and enable account.


ke 23. lokak. 2019 klo 4.38 Stephanie Semerville <
stephanie.semervi...@gmail.com> kirjoitti:

> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocJzy1FqtEvLuPzXgh3vEuEdPPgAVt56VjZrwKqBhwRMA%40mail.gmail.com.


Re: Auto assigning 2 types of user roles on sign up

2019-10-23 Thread Stephanie Semerville
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 <
> stephanie...@gmail.com > 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 django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/271b7fdf-cc8c-4408-b539-9902ff526db1%40googlegroups.com.


Re: Auto assigning 2 types of user roles on sign up

2019-10-23 Thread Nazish Akhtar
Hey.
I am working project where I need it. Five different roles, but users can 
have Multiple roles. Here is link to my git 
repo https://github.com/noobExtendsBot/django-custom-user form out side it 
in not documented enough (actually haven't commit on github) but you have a 
look inside models it is explained well. Note: I am using 'accounts' app to 
manage my users as user will need mobile number to login. You may want to 
have a look at model.py in account app. Here is the link 
https://github.com/noobExtendsBot/django-custom-user/blob/master/src/accounts/models.py

Please let me know if you need any help.


On Wednesday, 23 October 2019 07:08:29 UTC+5:30, Stephanie Semerville 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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8052585f-7ae8-4cff-b6e9-17b75bbec989%40googlegroups.com.


Re: Auto assigning 2 types of user roles on sign up

2019-10-22 Thread wd
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 <
stephanie.semervi...@gmail.com> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABexzmgF7s61Umbhe3-rLhfTC_V%2BQYkDCec-T0G89Hd4K5%2BYVA%40mail.gmail.com.


Auto assigning 2 types of user roles on sign up

2019-10-22 Thread Stephanie Semerville
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c80f1b02-d1e8-4a9d-a8ca-80af61260e79%40googlegroups.com.