Юриспруденция в IT
- 1 ответ
- 0 вопросов
5
Вклад в тег
class SupplyAdmin(admin.ModelAdmin):
available_fields = ('name', 'field1', 'field2')
hidden_fields = ('field3',)
def get_form(self, request, obj, **kwargs):
if request.user.username == 'example@example.com':
self.fields = self.available_fields + self.hidden_fields
else:
self.fields = self.available_fields
return super(SupplyAdmin, self).get_form(request, obj, **kwargs)
with open(path_in, 'w+') as read_file:
read_file.write('something')