I have an admin object where I want to pass in the request.user on
save. It works fine in my normal admin class but not for the inline
version.
(works fine here):
class RentAdmin(admin.ModelAdmin):
exclude = ['rented_by']
list_display = ('renter', 'movie', 'late', 'owed', 'paid',
'due_date', 'rented_by')
sort_by = '-due_date'
raw_id_fields = ('renter', 'movie')
(but not here):
class rentalInline(admin.TabularInline):
model= Rent
extra = 3
raw_id_fields = ('movie',)
exclude = ['rented_by']
def save_model(self, request, obj, form, change):
if not change:
obj.rented_by = request.user
obj.save()
Any help would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---