Git - Отменить выдвинутые коммиты

Мне удалось исправить это, не изменяя представление, добавив в мою форму чистый метод:

class SolutionForm(forms.ModelForm):
    class Meta:
        model = Solution
        exclude = ['problem']

    def clean(self):
        cleaned_data = self.cleaned_data

        try:
            Solution.objects.get(name=cleaned_data['name'], problem=self.problem)
        except Solution.DoesNotExist:
            pass
        else:
            raise ValidationError('Solution with this Name already exists for this problem')

        # Always return cleaned_data
        return cleaned_data

Единственное, что мне нужно сделать сейчас в представлении, - добавить свойство проблемы к перед выполнением is_valid.

448
задан Manolo 27 March 2014 в 09:11
поделиться

1 ответ

Вот мой путь:

Скажем, имя ответвления develop.

# Create a new temp branch based on one history commit
git checkout <last_known_good_commit_hash>
git checkout -b develop-temp

# Delete the original develop branch and 
# create a new branch with the same name based on the develop-temp branch
git branch -D develop
git checkout -b develop

# Force update this new branch
git push -f origin develop

# Remove the temp branch
git branch -D develop-temp

0
ответ дан 22 November 2019 в 22:37
поделиться
Другие вопросы по тегам:

Похожие вопросы: