permissions - Django Admin filter changelist by user -


I am filtering users in the admin based on the information of this post: My changelist was filtered as expected only The group "group name" has been filtered to the view of the changelist, only after seeing their incidents, the problem arises when they try to edit their programs, they make a change and receive feedback. May include that their event was successfully converted to the administrator, but there are unsaved changes. Can anyone tell me why? I would also like those users who are not in the group, who are being filtered, which are also allowed to edit events to save changes. Changes were being saved before starting filtering;)

  class FilterUserAdmin (admin.ModelAdmin): def save_model (auto, request, obj, form, change): if obj.user == None: Obj.user = request.user obj.save () Def queries (self, requested): qs = super (FilterUserAdmin, manually) .queryset (request) if request.user.groups.filter (name__in = ['group Name ',]): return qs.filter (user = request.user) Other: return qs def is_change_permission (auto, request, obj = none): if not obj: return True return obj.user == request.user class EventAdmin (FilterUserAdmin): Readonly_fields = ('Username List_filter = 'list_filter =' 'list_display =' ('id', 'production' partner ',' movie ',' date_time ',' location_name ',' city ',)) class media: JS = ('Tiny_MC / TI_MCAJS', 'TNI MCE / Textures.JS'), CSS = {'all': ('css / admin-mods.cs save_model only if my conditional is saved to  obj I == Anyone  is not being fixed. Def save_model (auto, request, obj, form, change): if obj.user == none: obj.user = request .user obj.save ()  < / Pre> 

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -