I have attached TestInline in the FoobarAdmin, this thing works well but i want logged in user to be pre-populated for the added_by field
from django.contrib import admin
from django.contrib.auth.models import User
class Test(models.Model):
description = models.TextField()
added_on = models.DateTimeField(auto_now_add=True)
added_by = models.ForeignKey(User, related_name='added_by',)
class TestInline(admin.TabularInline):
model = Test
extra = 1
class FoobarAdmin(admin.ModelAdmin):
inlines = [TestInline,]
admin.site.register(Foobar, FoobarAdmin)
Please let me know if its possible to have user prepopulated for the added_by field