Всем привет! Я плохо знаю джанго, поэтому надеюсь на Вашу помощь. Второй день бьюсь над проблемой. Хочу сделать на странице card форму создания и обновления записей collection. добился возможности создания, но никак не удается выполнить обновление записи.

model

class Card(models.Model):
id = models.CharField(max_length=256, primary_key=True)
oracle_id = models.CharField(max_length=256)
name = models.CharField(max_length=256)


 class Collection(models.Model):
    card = models.ForeignKey('Card', on_delete=models.CASCADE)
    owner = models.ForeignKey(User, verbose_name='User', on_delete=models.CASCADE)
    count = models.IntegerField()
    foil = models.BooleanField()
    class Meta:
        unique_together = [['card','owner', 'foil']]

forms

class CollectionAddForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    class Meta:
        model = Collection
        fields = '__all__'
        #     [
        #     'count',
        #     'foil',
        #     'card',
        #     'owner',
        # ]
        widgets = {'card': forms.HiddenInput(), 'owner': forms.HiddenInput()}

views

class CardDetailView( FormMixin, DataMixin, generic.DetailView):

model = Card
template_name = 'catalog/card_detail.html'
form_class = CollectionAddForm
def get_context_data(self, **kwargs):
    context = super(CardDetailView, self).get_context_data(**kwargs)
    # Количество записей в колекции
    if self.request.user:
        collectionsFoil = Collection.objects.filter(card=self.object.pk, owner=self.request.user, foil=True)
        if collectionsFoil:
            context['collectionsFoil'] = Collection.objects.get(card=self.object.pk, owner=self.request.user,
                                                                foil=True).id
            coolectObj = get_object_or_404(Collection, id=context['collectionsFoil'])
            context['collection_non_foil'] = CollectionAddForm(instance=coolectObj)
        else:
            context['collection_non_foil'] = CollectionAddForm(initial={
                'card': self.object.pk,
                'owner': self.request.user,
                'foil': True
            })

        collectionsNotFoil = Collection.objects.filter(card=self.object.pk, owner=self.request.user, foil=False)
        if collectionsNotFoil:
            context['collectionsNotFoil'] = Collection.objects.get(card=self.object.pk, owner=self.request.user,
                                                                   foil=False).id
            coolectObj = get_object_or_404(Collection, id=context['collectionsNotFoil'])

            context['collection_foil'] = CollectionAddForm(instance=coolectObj)
        else:
            context['collection_foil'] = CollectionAddForm(initial={
                'card': self.object.pk,
                'owner': self.request.user,
                'foil': False
            })
        # context['collection_foil'] = CollectionAddForm()
    c_def = self.get_user_context(title=self.object.name)
    return dict(list(context.items()) + list(c_def.items()))

def get_success_url(self):
    return reverse("card_detail", kwargs={'pk': self.object.pk})



def post(self, request, *args, **kwargs):
    self.object = self.get_object()
    form = self.get_form()
    if form.is_valid():
        return self.form_valid(form)
    else:
        return self.form_invalid(form)

def form_valid(self, form):
    form.save()
    return super(CardDetailView, self).form_valid(form)