[Answered ]-Django — Only Displaying Objects A User Created

2👍

In your user_create view,

def user_create(request):
    if request.method == 'POST':
        list_form = forms.ListForm(request.POST)
        if list_form.is_valid():
            list_create = list_form.save()
            messages.success(request, 'List {0} created'.format(list_create.list_id))
            up, _ = UserProfile.objects.get_or_create(user=request.user, list_id=list_create)
            return redirect(reverse('user_dashboard', args=(2,))) # 2 is just an example

    #rest of the code

Basically, all you need to do is create a userprofile object.

Leave a comment