J
J
joli2019-03-26 20:14:00
Django
joli, 2019-03-26 20:14:00

How to write posts on your account page?

Hello, how can I add the ability for authorized users to write posts in their profile?
I will be glad for any help

#models.py
class Profile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)

#views.py
def user_detail(request, username):
    user = get_object_or_404(User, username=username, is_active=True)
    return render(request, 'account/user_detail.html', {'user': user})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yura Khlyan, 2019-03-27
@joli

  1. Need to create a molePost
  2. Create CRUD views for it
  3. Create templates to render everything
  4. Add display logic
  5. ?????
  6. PROFIT!!!11

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question