Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foreign key to meals on log #842

Merged
merged 4 commits into from
Oct 12, 2021

Conversation

Alig1493
Copy link

@Alig1493 Alig1493 commented Oct 3, 2021

Proposed Changes

  • add a field log_item to Meals model inside nutrition
  • add a test to check if meals are added to logitems upon creating logs.

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Added yourself to AUTHORS.rst

Other questions

  • Do users need to run some commands in their local instances due to this PR
    (e.g. database migration)?
  • Yes. One db migration for nutrition has been added.

#819

null=True,
on_delete=models.SET_NULL,
related_name="meals"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The foreign key should be in the logs, sorry if it wasn't very clear. Then in _logMealPlan you can simply set the current meal when creating the LogItem instance

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay okay. sorry my bad i'll get it sorted

@rolandgeider
Copy link
Member

I'll review this later today or tomorrow at the latest

@@ -263,13 +263,15 @@ def __init__(self, *args, **kwargs):


class MealLogItemForm(MealItemForm):
meal = forms.ModelChoiceField(queryset=Meal.objects.all(), required=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, now that I'm thinking about it, better remove the meal from this form, then I can merge the PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do.

@rolandgeider rolandgeider merged commit 9b3b83b into wger-project:master Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants