Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:49:34+00:00 2026-06-13T19:49:34+00:00

I haven’t found any documentation or tutorials on this topic, haven’t received any answers

  • 0

I haven’t found any documentation or tutorials on this topic, haven’t received any answers on the IRC channel either so it makes me think I’m looking for the wrong thing. Anyway, resorting to SO after several hours of searching. I’ll try to describe what I’m after by example:

  1. I want to create a web application where user could create an account (this part is rather clear
  2. After logging in, user would be able to store his favorite meals
  3. When a user is logged in, he would see a list of his favorite meals and he could edit them

I understand how user can create account and log in. But everything after that is kind of blurry.

After user logs in, let’s say he would be presented with a form he could fill in and save. How should the database (models) be designed to handle this? Would each user get his own table? How to retrieve the user stored data (i.e. favorite foods) from the database?

These are the things I’m trying to figure out while learning django/programming in general. As I said I haven’t found it described in any books, docs or tutorials I went through.

I would appreciate if you could point me to the right direction. I feel like I’m missing something here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:49:35+00:00Added an answer on June 13, 2026 at 7:49 pm

    Basic stuff:

    1. make a foreign key for the user in your model
    2. suppress the user field from the form
    3. save the form with commit=False, set the user to the authenticated user and save the model.

    The rest you can get pretty straight forward from the tutorial.

    For example:

    # At models.py
    from django.contrib.auth.models import User
    
    
    class FavoriteMeal(models.Model):
        user = models.ForeignKey(User)
        # other fields...
    
    # At forms.py
    class FavoriteMealForm(forms.ModelForm):
        class Meta:
            model = FavoriteMeal
            exclude = ('user', )
    
    # At views.py
    @login_required
    def favorite_meals_view(request):
        favorite_meals = FavoriteMeal.objects.filter(user=request.user)
        ...
        if request.method == 'POST':
            form = FavoriteMealForm(request.POST)
            if form.is_valid():
                favorite_meal = form.save(commit=False)
                favorite_meal.user = request.user
                favorite_meal.save()
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Haven't been able to figure this out yet.. I've seen a few answers around
I haven't found a definite answer to this yet. Lots of apps let you
Haven't found this in my search on Stackoverflow - I know I've seen a
Haven't found anything useful about this on the internet. I'm using my Windows 7
I haven't found any get equivalent to appendBytes. If I've understood getBytes correctly, that
Haven't found a solution to this problem yet, have tried some things... I have
I haven't used the STL much before, but I started to on this huffman
I haven't been able to get this working and all of the sample code
I haven't actually built an app yet, but I'm confused by documentation on bind-attr.
I haven't found a straight answer to how to make an animation in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.