I developed a Django Application and it was working correctly, **until I did a data migration** to the database created by django migration, I migrated the data using an sql script and Pgadmin.

Now I have the database full with records but when I am trying to add new record using django form I got the below error: 

> 
> duplicate key value violates unique constraint > "learningcenters\_partnerorganization\_pkey"
>  DETAIL: Key (id)=(1) already exists.
> 
> 
> 

taking into consideration that the available id for this table is 10.

Model:

```
class SLPAcademicRound(models.Model):
    name = models.CharField(max_length=45,
                            unique=True,
                            verbose_name=_('Academic Round Name'))
    code = models.CharField(max_length=5,
                            unique=True,
                            verbose_name=_('Code'))
    cycle = models.ForeignKey(
        SLPCycle,
        blank=False, null=True,
        verbose_name=_('SLP Cycle/SLP Cycle'),
        on_delete=models.CASCADE,
    )

    learning_center = models.ForeignKey(
        LearningCenter,
        blank=False, null=True,
        verbose_name=_('Learning Center'),
        on_delete=models.CASCADE,
    )

    round_date_start = models.DateField(
        blank=True,
        null=True,
        verbose_name=_('SLP Round Start Date')
    )
    round_date_end = models.DateField(
        blank=True,
        null=True,
        verbose_name=_('SLP Round End Date')
    )
    current_round = models.BooleanField(
        blank=True,
        null=True,
        verbose_name=_('Current Round')
    )

```

View:

```
class AddSLPAcademicRoundView(LoginRequiredMixin,
              GroupRequiredMixin,
              CreateView):

    template_name = 'bootstrap4/common_form.html'
    form_class = SLPAcademicRoundForm
    queryset= SLPAcademicRound.objects.all()
    group_required = ["LearningCenterManager"]

    def get_absolute_url(self):
        return reverse("slp:slp_academic_round_list")

    def form_valid(self, form):
        print((form.cleaned_data))
        form.save(self.request)
        return super(AddSLPAcademicRoundView, self).form_valid(form)

    def get_form_kwargs(self, *args, **kwargs):
        kwargs = super().get_form_kwargs(*args, **kwargs)
        kwargs['user'] = self.request.user
        return kwargs

```