unique constraint error when editing record

IntegrityError at /player/edit/2
UNIQUE constraint failed: players_player.id

I’ve set up a CRUD interface using generic views (CreateView, DetailView…) and am having trouble with the UpdateView (which I call EditView).

IntegrityError at /player/edit/2/

UNIQUE constraint failed: players_player.id

I have a default number for the player ranking, though I want that to be automatically determined based on the number of available players. When I try to update it on the form, I get the above error. I’m puzzled by this error since I’m not trying to create a new player. Also, if I open the SQLite database using a DB reader, it looks like I simply have four records with PKs 1 - 4. Why does Django think I’m violating the uniqueness constraint?

Here is the model:
class Player(models.Model):
# Availability choice list
available = ‘AVL’
injured = ‘INJ’
away = ‘AWY’
retired = ‘RET’
AVAILABILITY_CHOICES = [
(available, ‘available’),
(injured, ‘injured’),
(away, ‘out of town’),
(retired, ‘retired’)
]

# Player fields
first = models.CharField('First Name', max_length=30)
last = models.CharField('Last Name', max_length=30)
cell = models.CharField('Cell Phone', max_length=12)
email = models.EmailField('Email') # changed field type
availability = models.CharField('Availability', choices = AVAILABILITY_CHOICES, \
                                 max_length = 15, default='AVL')
ranking = models.IntegerField(default = 99)

def __str__(self):
    full_name = self.first + ' ' + self.last + ' ' + str(self.ranking)
    return full_name

the urlpatterns list contains:
path(‘player/edit/int:pk/’, PlayerEditView.as_view(), name=‘player_edit’),

class PlayerListView(ListView):
model = Player
template_name = ‘players_list.html’

class PlayerEditView(UpdateView):
model =Player
context_object_name = ‘player’
fields = [‘ranking’, ‘first’, ‘last’, ‘cell’, ‘email’, ‘availability’]
template_name = ‘player_edit.html’

And the template contains this relevant portion…

{% csrf_token %} {{ form.as_table }} (for some reason the input field does not show up in the UsingDjango post) (it contains input type = "submit value = "Update")
Cancel
{% endblock content %}

First, whenever you post code, please enclose your code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```.
This will preserve the formatting and prevent substitution of special formatting characters.

We’ll also need to see the complete view, form, and the relevant portion of the template. (Put the fences - ``` around the template as well.)