Cada vez que entro en un nuevo reproductor en la sección de administración de Django, aparece un mensaje de error que dice "Este campo es obligatorio".
¿Hay alguna manera de hacer que un campo no sea obligatorio sin tener que crear un formulario personalizado? ¿Puedo hacer esto dentro de models.py o admin.py?
Así es como se ve mi clase en 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"
        )
Gracias
                    
                        python
                                django
                                django-models
                                django-admin
                                django-forms
                                
                    
                    
                        bigmike7801
fuente
                
                fuente

Respuestas:
Sólo hay que poner
blank=Trueen su modelo, es decir:
rushing_attempts = models.CharField( max_length = 100, verbose_name = "Rushing Attempts", blank=True )fuente
Use espacio en blanco = Verdadero, nulo = Verdadero
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 )fuente