Basically, I want to know if there is a request.user replacement when using user users in Django.
My posts / models.py file has the following:
class Post(models.Model): text = models.TextField() user_id = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='posts') class EduUser(AbstractUser):
In my settings file:
AUTH_USER_MODEL = 'posts.EduUser'
In my views file:
if request.method == 'POST': Post.objects.create(text = request.POST['post_content'], user_id = request.user )
Of course, this returns an error saying "Post.user_id" must be a "EduUser" instance. Any ideas on what needs to replace request.user ? Any help is much appreciated!
source share