I'm rather searchung the way to do that in my admin.py file not in core
files.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/sZ83LDHBIC8J.
To post to thi
Yes I read it. exclude = ('groups',) throws:
Caught KeyError while rendering: "Key 'groups' not found in Form"
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-use
Ok but like I said in previous post, exclude = ('groups',) etc doesn't work
:/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/-exygvWEN9UJ.
To post to thi
Any idea how to overwrite it dynamically?
def get_form(self, request, obj=None, **kwargs):
self.exclude = ('user_permissions',)
return super(UserProfileAdmin, self).get_form(request, obj=None,
**kwargs)
Throws:
TemplateSyntaxError at /admin/auth/user/2/
Caught KeyError while rende
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin/auth/user/2/
Django Version: 1.3
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'djan
Dnia 2011-07-04, pon o godzinie 14:19 -0700, galgal pisze:
> I'm rather searchung the way to do that in my admin.py file not in
> core files.
Obviously the proposal was... fundamentally wrong.
Create your own UserAdmin, unregister the one registered by
django.contrib.admin and register your own.
Dnia 2011-07-04, pon o godzinie 15:20 -0700, galgal pisze:
> Yes I read it. exclude = ('groups',) throws:
> Caught KeyError while rendering: "Key 'groups' not found in Form"
That's because the stock UserAdmin defines fieldsets in which 'groups'
is a field, you need to modify the fieldsets, too.
That's my code now - how to hide groups for example?
admin.site.unregister(User)
class UserProfileInline(admin.StackedInline):
model = UserProfile
filter_horizontal = ('cities',)
extra = 1
max_num = 1
filter_horizontal = ('cities',)
class UserProfileAdmin(UserAdmin):
inlin
I made it in that way, and it works:
def get_fieldsets(self, request, obj=None):
if obj:
if request.user.id == 1:
return self.declared_fieldsets
else:
if obj.get_profile().type==1:
return (
(
9 matches
Mail list logo