Re: How to make the column "user" to be auto selected in a form.

2018-07-24 Thread Mikhailo Keda
you need to set initial in admin.py for this field, check this example - https://bitbucket.org/voron-raven/maps/src/004eaa07612fd44b398dfdc61b5f9cb29ad23668/core/admin.py#lines-39 if it's not admin page - you need to pass initial to your Model form - https://docs.djangoproject.com/en/2.0/topics

How to make the column "user" to be auto selected in a form.

2018-07-24 Thread John Son
*models.py* class Post(models.Model): title = models.CharField(max_length=200) body = models.TextField() user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True) date = models.DateField(default=datetime.now, blank=True) text_author = models.CharField(max_length