Meals   A
last analyzed

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Importance

Changes 5
Bugs 0 Features 1
Metric Value
c 5
b 0
f 1
dl 19
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __str__() 2 2 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
# coding: utf-8
2
from django.contrib.auth.models import User
3
from django.db import models
4
5
6 View Code Duplication
class Meals(models.Model):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
8
    """
9
        Meals
10
    """
11
    user = models.ForeignKey(User, on_delete=models.CASCADE)
12
    food = models.TextField()
13
    breakfast_lunch_diner = models.CharField(max_length=2)
14
    date_meals = models.DateField(null=True)
15
    hour_meals = models.TimeField(null=True)
16
    created = models.DateTimeField(auto_now_add=True)
17
    modified = models.DateTimeField(auto_now=True)
18
19
    class Meta:
20
        verbose_name = 'Meal'
21
        verbose_name_plural = 'Meals'
22
23
    def __str__(self):
24
        return "%s (date: %s)" % (self.food, self.date_meals)
25