Re: [mezzanine-users] Need some help with assigning user site permission in a view

2016-07-21 Thread zruu
Thank you man! This helped me out A LOT! 

Cheers!

Den torsdag 21 juli 2016 kl. 23:20:24 UTC+2 skrev Ryne Everett:
>
> Ah, that makes sense. I guess you can't pass ManyToManyField's in the 
> constructor. Try:
>
> siteperms = SitePermissions.objects.create(user=user)
> siteperms.sites.add(site)
>
> On Thu, Jul 21, 2016 at 5:15 PM, zruu  
> wrote:
>
>> Hi Ryne,
>>
>> Thanks for the quick reply. That was what I was looking for. I have a 
>> form on the front end that a user can create a site, and a user account at 
>> the same time. I want to automate this to minimize the administration as 
>> possible.
>>
>> However I tried that, and I got the error:
>>
>> 'sites' is an invalid keyword argument for this function
>>
>>
>>
>> Den torsdag 21 juli 2016 kl. 23:07:40 UTC+2 skrev Ryne Everett:
>>>
>>> SitePermission.objects.create(user=user, sites=(site,))
>>>
>>> I question whether this is really what you want to do, but without a 
>>> better idea what your goal is it's all I can offer.
>>>
>>> On Thu, Jul 21, 2016 at 4:56 PM, zruu  wrote:
>>>
 Hey guys,

 I really need your help. I'm stuck at the moment. Maybe is too late. 
 However. I need to in my class view add site permission instead of using 
 through the admin. I have no clue how to do this.

 I looked through the Mezzanine code and all I found was this piece of 
 code that looks something of value:

 sites = user.sitepermissions.sites.all() 

 *What I want to accomplish is to first to create the site object in my 
 view:*

 site = Site.objects.create(name=name, domain=domain)

 Then set permission for my user to that site. How could I do this?



 -- 
 You received this message because you are subscribed to the Google 
 Groups "Mezzanine Users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to mezzanine-use...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Need some help with assigning user site permission in a view

2016-07-21 Thread Ryne Everett
Ah, that makes sense. I guess you can't pass ManyToManyField's in the
constructor. Try:

siteperms = SitePermissions.objects.create(user=user)
siteperms.sites.add(site)

On Thu, Jul 21, 2016 at 5:15 PM, zruu  wrote:

> Hi Ryne,
>
> Thanks for the quick reply. That was what I was looking for. I have a form
> on the front end that a user can create a site, and a user account at the
> same time. I want to automate this to minimize the administration as
> possible.
>
> However I tried that, and I got the error:
>
> 'sites' is an invalid keyword argument for this function
>
>
>
> Den torsdag 21 juli 2016 kl. 23:07:40 UTC+2 skrev Ryne Everett:
>>
>> SitePermission.objects.create(user=user, sites=(site,))
>>
>> I question whether this is really what you want to do, but without a
>> better idea what your goal is it's all I can offer.
>>
>> On Thu, Jul 21, 2016 at 4:56 PM, zruu  wrote:
>>
>>> Hey guys,
>>>
>>> I really need your help. I'm stuck at the moment. Maybe is too late.
>>> However. I need to in my class view add site permission instead of using
>>> through the admin. I have no clue how to do this.
>>>
>>> I looked through the Mezzanine code and all I found was this piece of
>>> code that looks something of value:
>>>
>>> sites = user.sitepermissions.sites.all()
>>>
>>> *What I want to accomplish is to first to create the site object in my
>>> view:*
>>>
>>> site = Site.objects.create(name=name, domain=domain)
>>>
>>> Then set permission for my user to that site. How could I do this?
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to mezzanine-use...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Need some help with assigning user site permission in a view

2016-07-21 Thread zruu
Hi Ryne,

Thanks for the quick reply. That was what I was looking for. I have a form 
on the front end that a user can create a site, and a user account at the 
same time. I want to automate this to minimize the administration as 
possible.

However I tried that, and I got the error:

'sites' is an invalid keyword argument for this function



Den torsdag 21 juli 2016 kl. 23:07:40 UTC+2 skrev Ryne Everett:
>
> SitePermission.objects.create(user=user, sites=(site,))
>
> I question whether this is really what you want to do, but without a 
> better idea what your goal is it's all I can offer.
>
> On Thu, Jul 21, 2016 at 4:56 PM, zruu  
> wrote:
>
>> Hey guys,
>>
>> I really need your help. I'm stuck at the moment. Maybe is too late. 
>> However. I need to in my class view add site permission instead of using 
>> through the admin. I have no clue how to do this.
>>
>> I looked through the Mezzanine code and all I found was this piece of 
>> code that looks something of value:
>>
>> sites = user.sitepermissions.sites.all() 
>>
>> *What I want to accomplish is to first to create the site object in my 
>> view:*
>>
>> site = Site.objects.create(name=name, domain=domain)
>>
>> Then set permission for my user to that site. How could I do this?
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Need some help with assigning user site permission in a view

2016-07-21 Thread Ryne Everett
SitePermission.objects.create(user=user, sites=(site,))

I question whether this is really what you want to do, but without a better
idea what your goal is it's all I can offer.

On Thu, Jul 21, 2016 at 4:56 PM, zruu  wrote:

> Hey guys,
>
> I really need your help. I'm stuck at the moment. Maybe is too late.
> However. I need to in my class view add site permission instead of using
> through the admin. I have no clue how to do this.
>
> I looked through the Mezzanine code and all I found was this piece of code
> that looks something of value:
>
> sites = user.sitepermissions.sites.all()
>
> *What I want to accomplish is to first to create the site object in my
> view:*
>
> site = Site.objects.create(name=name, domain=domain)
>
> Then set permission for my user to that site. How could I do this?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Need some help with assigning user site permission in a view

2016-07-21 Thread zruu
Hey guys,

I really need your help. I'm stuck at the moment. Maybe is too late. 
However. I need to in my class view add site permission instead of using 
through the admin. I have no clue how to do this.

I looked through the Mezzanine code and all I found was this piece of code 
that looks something of value:

sites = user.sitepermissions.sites.all() 

*What I want to accomplish is to first to create the site object in my 
view:*

site = Site.objects.create(name=name, domain=domain)

Then set permission for my user to that site. How could I do this?



-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.