1 | 206,210c206
|
---|
2 | <
|
---|
3 | < if self.has_change_permission(request, obj):
|
---|
4 | < return self.readonly_fields
|
---|
5 | <
|
---|
6 | < return flatten_fieldsets(self.declared_fieldsets)
|
---|
7 | ---
|
---|
8 | > return self.readonly_fields
|
---|
9 | 284,294d279
|
---|
10 | <
|
---|
11 | < def has_view_permission(self, request, obj=None):
|
---|
12 | < """
|
---|
13 | < Returns True if the given request has permission to add an object.
|
---|
14 | < Can be overriden by the user in subclasses.
|
---|
15 | < """
|
---|
16 | < opts = self.opts
|
---|
17 | <
|
---|
18 | < return request.user.has_perm(opts.app_label + '.view_%s' % opts.object_name.lower())
|
---|
19 | < #must add a method to opts
|
---|
20 | < #return request.user.has_perm(opts.app_label + '.' + opts.has_view_permission())
|
---|
21 | 367,368c352
|
---|
22 | < if not (inline.has_view_permission(request) or
|
---|
23 | < inline.has_add_permission(request) or
|
---|
24 | ---
|
---|
25 | > if not (inline.has_add_permission(request) or
|
---|
26 | 668,677d651
|
---|
27 | <
|
---|
28 | < def get_list_editable(self, request):
|
---|
29 | < """
|
---|
30 | < Return a sequence containing the fields to be edited on the
|
---|
31 | < changelist.
|
---|
32 | < """
|
---|
33 | < if self.has_change_permission(request):
|
---|
34 | < return self.list_editable
|
---|
35 | <
|
---|
36 | < return ()
|
---|
37 | 1044,1046c1018,1020
|
---|
38 | <
|
---|
39 | < if not self.has_view_permission(request, obj):
|
---|
40 | < raise PermissionDenied
|
---|
41 | ---
|
---|
42 | >
|
---|
43 | > if not self.has_change_permission(request, obj):
|
---|
44 | > raise PermissionDenied
|
---|
45 | 1060,1063d1033
|
---|
46 | <
|
---|
47 | < if not self.has_change_permission(request, obj):
|
---|
48 | < raise PermissionDenied
|
---|
49 | <
|
---|
50 | 1091,1094d1060
|
---|
51 | <
|
---|
52 | < if not self.has_view_permission(request, obj):
|
---|
53 | < raise PermissionDenied
|
---|
54 | <
|
---|
55 | 1144,1145c1110
|
---|
56 | <
|
---|
57 | < if not self.has_view_permission(request, None):
|
---|
58 | ---
|
---|
59 | > if not self.has_change_permission(request, None):
|
---|
60 | 1147,1149d1111
|
---|
61 | <
|
---|
62 | < if not self.has_change_permission(request, None) and request.method == "POST":
|
---|
63 | < raise PermissionDenied
|
---|
64 | 1153d1114
|
---|
65 | < list_editable = self.get_list_editable(request)
|
---|
66 | 1166c1127
|
---|
67 | < self.list_per_page, self.list_max_show_all, list_editable,
|
---|
68 | ---
|
---|
69 | > self.list_per_page, self.list_max_show_all, self.list_editable,
|
---|
70 | 1368,1371d1328
|
---|
71 | <
|
---|
72 | < if not self.has_view_permission(request, obj):
|
---|
73 | < raise PermissionDenied
|
---|
74 | <
|
---|