Puis-je créer un champ admin non requirejs dans Django sans créer de formulaire?

Chaque fois que j’entre un nouveau lecteur dans la partie Admin de Django, je reçois un message d’erreur indiquant “Ce champ est obligatoire”.

Est-il possible de rendre un champ inutile sans avoir à créer un formulaire personnalisé? Puis-je faire cela dans models.py ou admin.py?

Voici à quoi ressemble ma classe dans models.py.

class PlayerStat(models.Model): player = models.ForeignKey(Player) rushing_attempts = models.CharField( max_length = 100, verbose_name = "Rushing Attempts" ) rushing_yards = models.CharField( max_length = 100, verbose_name = "Rushing Yards" ) rushing_touchdowns = models.CharField( max_length = 100, verbose_name = "Rushing Touchdowns" ) passing_attempts = models.CharField( max_length = 100, verbose_name = "Passing Attempts" ) 

Merci

Juste mettre

 blank=True 

dans votre modèle à savoir:

 rushing_attempts = models.CharField( max_length = 100, verbose_name = "Rushing Attempts", blank=True ) 

Utilisez blank = True, null = True

 class PlayerStat(models.Model): player = models.ForeignKey(Player) rushing_attempts = models.CharField( max_length = 100, verbose_name = "Rushing Attempts", blank=True, null=True ) rushing_yards = models.CharField( max_length = 100, verbose_name = "Rushing Yards", blank=True, null=True ) rushing_touchdowns = models.CharField( max_length = 100, verbose_name = "Rushing Touchdowns", blank=True, null=True ) passing_attempts = models.CharField( max_length = 100, verbose_name = "Passing Attempts", blank=True, null=True )