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 <[email protected]> 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
