Is there a way to set the ForeignKey(User) or ForeignKey(PermissionGroup) automatically by the logged user?
On Jul 2, 2014, at 8:31 AM, Lachlan Musicman <data...@gmail.com> wrote: > There are a couple of ways to do it, filtered queries are the obvious solution > > https://docs.djangoproject.com/en/1.6/topics/db/queries/#retrieving-specific-objects-with-filters > > But it would require that your model have either a group or owner > permission set. > > (eg > class MyModel(models.Model): > permission_level = ForeignKey(PermissionGroup) > or > owner = ForeignKey(User) > ) > > This has some good examples too > > http://www.django-rest-framework.org/api-guide/permissions > > > cheers > L. > > > On 2 July 2014 21:21, Jonathan Querubina <john.chro...@gmail.com> wrote: >> Hi guys, >> >> I need to customize my admin to show only the data related to the user who >> inserted. >> >> Example: When a user log in, the admin shows only the posts inserted by this >> user. >> >> AFAIK, django only set permissions my model, not by objects. >> >> Is there a way (or a pip package) to implement this? >> >> Thanks! >> >> >> Att// >> >> -- >> 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 post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/E151B4A3-E3F3-4E26-9342-85E5212C2241%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. > > > > -- > The idea is that a beautiful image is frameable. Everything you need > to see is there: It’s everything you want, and it’s very pleasing > because there’s no extra information that you don’t get to see. > Everything’s in a nice package for you. But sublime art is > unframeable: It’s an image or idea that implies that there’s a bigger > image or idea that you can’t see: You’re only getting to look at a > fraction of it, and in that way it’s both beautiful and scary, because > it’s reminding you that there’s more that you don’t have access to. > It’s now sort of left the piece itself and it’s become your own > invention, so it’s personal as well as being scary as well as being > beautiful, which is what I really like about art like that. > ----------------------------------------------------------------------------------------------------------- > Adventure Time http://theholenearthecenteroftheworld.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 post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAGBeqiM%2B5Eb8LxUv8N7cW7st8jesJ8Ec-m0wMj8WJAi3JC1YwA%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/E662808C-4910-4113-9270-1351D3765AE4%40gmail.com. For more options, visit https://groups.google.com/d/optout.