prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Migration warns for phantom part changes 
  Here is the warning:
  
  ```
  Your models in app(s): 'part' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
  ```
  
  Running `manage.py makemigrations` does **not** generate new migration file...
  
  Running `manage.py showmigrations part` shows all part migrations are complete.
  
  I found this warning both with PostGreSQL and SQLite3, if that has anything to do with backend dependency.
  
  </issue>
  <code>
  [start of InvenTree/InvenTree/fields.py]
  1 """ Custom fields used in InvenTree """
  2 
  3 # -*- coding: utf-8 -*-
  4 from __future__ import unicode_literals
  5 import sys
  6 
  7 from .validators import allowable_url_schemes
  8 
  9 from django.utils.translation import ugettext_lazy as _
  10 
  11 from django.forms.fields import URLField as FormURLField
  12 from django.db import models as models
  13 from django.core import validators
  14 from django import forms
  15 
  16 from decimal import Decimal
  17 
  18 from djmoney.models.fields import MoneyField as ModelMoneyField
  19 from djmoney.forms.fields import MoneyField
  20 from djmoney.models.validators import MinMoneyValidator
  21 
  22 import InvenTree.helpers
  23 
  24 
  25 class InvenTreeURLFormField(FormURLField):
  26     """ Custom URL form field with custom scheme validators """
  27 
  28     default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]
  29 
  30 
  31 class InvenTreeURLField(models.URLField):
  32     """ Custom URL field which has custom scheme validators """
  33 
  34     default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]
  35 
  36     def formfield(self, **kwargs):
  37         return super().formfield(**{
  38             'form_class': InvenTreeURLFormField
  39         })
  40 
  41 
  42 def money_kwargs():
  43     """ returns the database settings for MoneyFields """
  44     from common.settings import currency_code_mappings, currency_code_default
  45 
  46     kwargs = {}
  47     kwargs['currency_choices'] = currency_code_mappings()
  48     kwargs['default_currency'] = currency_code_default()
  49     return kwargs
  50 
  51 
  52 class InvenTreeModelMoneyField(ModelMoneyField):
  53     """
  54     Custom MoneyField for clean migrations while using dynamic currency settings
  55     """
  56     
  57     def __init__(self, **kwargs):
  58         # detect if creating migration
  59         if 'makemigrations' in sys.argv:
  60             # remove currency information for a clean migration
  61             kwargs['default_currency'] = ''
  62             kwargs['currency_choices'] = []
  63         else:
  64             # set defaults
  65             kwargs.update(money_kwargs())
  66 
  67         # Set a minimum value validator
  68         validators = kwargs.get('validators', [])
  69 
  70         if len(validators) == 0:
  71             validators.append(
  72                 MinMoneyValidator(0),
  73             )
  74 
  75         kwargs['validators'] = validators
  76 
  77         super().__init__(**kwargs)
  78 
  79     def formfield(self, **kwargs):
  80         """ override form class to use own function """
  81         kwargs['form_class'] = InvenTreeMoneyField
  82         return super().formfield(**kwargs)
  83 
  84 
  85 class InvenTreeMoneyField(MoneyField):
  86     """ custom MoneyField for clean migrations while using dynamic currency settings """
  87     def __init__(self, *args, **kwargs):
  88         # override initial values with the real info from database
  89         kwargs.update(money_kwargs())
  90         super().__init__(*args, **kwargs)
  91 
  92 
  93 class DatePickerFormField(forms.DateField):
  94     """
  95     Custom date-picker field
  96     """
  97 
  98     def __init__(self, **kwargs):
  99 
  100         help_text = kwargs.get('help_text', _('Enter date'))
  101         label = kwargs.get('label', None)
  102         required = kwargs.get('required', False)
  103         initial = kwargs.get('initial', None)
  104 
  105         widget = forms.DateInput(
  106             attrs={
  107                 'type': 'date',
  108             }
  109         )
  110 
  111         forms.DateField.__init__(
  112             self,
  113             required=required,
  114             initial=initial,
  115             help_text=help_text,
  116             widget=widget,
  117             label=label
  118         )
  119 
  120 
  121 def round_decimal(value, places):
  122     """
  123     Round value to the specified number of places.
  124     """
  125 
  126     if value is not None:
  127         # see https://docs.python.org/2/library/decimal.html#decimal.Decimal.quantize for options
  128         return value.quantize(Decimal(10) ** -places)
  129     return value
  130 
  131 
  132 class RoundingDecimalFormField(forms.DecimalField):
  133     def to_python(self, value):
  134         value = super(RoundingDecimalFormField, self).to_python(value)
  135         value = round_decimal(value, self.decimal_places)
  136         return value
  137 
  138     def prepare_value(self, value):
  139         """
  140         Override the 'prepare_value' method, to remove trailing zeros when displaying.
  141         Why? It looks nice!
  142         """
  143 
  144         if type(value) == Decimal:
  145             return InvenTree.helpers.normalize(value)
  146         else:
  147             return value
  148 
  149 
  150 class RoundingDecimalField(models.DecimalField):
  151     def to_python(self, value):
  152         value = super(RoundingDecimalField, self).to_python(value)
  153         return round_decimal(value, self.decimal_places)
  154 
  155     def formfield(self, **kwargs):
  156         defaults = {
  157             'form_class': RoundingDecimalFormField
  158         }
  159 
  160         defaults.update(kwargs)
  161 
  162         return super().formfield(**kwargs)
  163
  [end of InvenTree/InvenTree/fields.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/InvenTree/InvenTree/fields.py b/InvenTree/InvenTree/fields.py
  --- a/InvenTree/InvenTree/fields.py
  +++ b/InvenTree/InvenTree/fields.py
  @@ -55,7 +55,7 @@
       
       def __init__(self, **kwargs):
           # detect if creating migration
  -        if 'makemigrations' in sys.argv:
  +        if 'migrate' in sys.argv or 'makemigrations' in sys.argv:
               # remove currency information for a clean migration
               kwargs['default_currency'] = ''
               kwargs['currency_choices'] = []
  
verification_info: {"golden_diff": "diff --git a/InvenTree/InvenTree/fields.py b/InvenTree/InvenTree/fields.py\n--- a/InvenTree/InvenTree/fields.py\n+++ b/InvenTree/InvenTree/fields.py\n@@ -55,7 +55,7 @@\n     \n     def __init__(self, **kwargs):\n         # detect if creating migration\n-        if 'makemigrations' in sys.argv:\n+        if 'migrate' in sys.argv or 'makemigrations' in sys.argv:\n             # remove currency information for a clean migration\n             kwargs['default_currency'] = ''\n             kwargs['currency_choices'] = []\n", "issue": "Migration warns for phantom part changes \nHere is the warning:\r\n\r\n```\r\nYour models in app(s): 'part' have changes that are not yet reflected in a migration, and so won't be applied.\r\nRun 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.\r\n```\r\n\r\nRunning `manage.py makemigrations` does **not** generate new migration file...\r\n\r\nRunning `manage.py showmigrations part` shows all part migrations are complete.\r\n\r\nI found this warning both with PostGreSQL and SQLite3, if that has anything to do with backend dependency.\n", "before_files": [{"content": "\"\"\" Custom fields used in InvenTree \"\"\"\n\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport sys\n\nfrom .validators import allowable_url_schemes\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom django.forms.fields import URLField as FormURLField\nfrom django.db import models as models\nfrom django.core import validators\nfrom django import forms\n\nfrom decimal import Decimal\n\nfrom djmoney.models.fields import MoneyField as ModelMoneyField\nfrom djmoney.forms.fields import MoneyField\nfrom djmoney.models.validators import MinMoneyValidator\n\nimport InvenTree.helpers\n\n\nclass InvenTreeURLFormField(FormURLField):\n    \"\"\" Custom URL form field with custom scheme validators \"\"\"\n\n    default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]\n\n\nclass InvenTreeURLField(models.URLField):\n    \"\"\" Custom URL field which has custom scheme validators \"\"\"\n\n    default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]\n\n    def formfield(self, **kwargs):\n        return super().formfield(**{\n            'form_class': InvenTreeURLFormField\n        })\n\n\ndef money_kwargs():\n    \"\"\" returns the database settings for MoneyFields \"\"\"\n    from common.settings import currency_code_mappings, currency_code_default\n\n    kwargs = {}\n    kwargs['currency_choices'] = currency_code_mappings()\n    kwargs['default_currency'] = currency_code_default()\n    return kwargs\n\n\nclass InvenTreeModelMoneyField(ModelMoneyField):\n    \"\"\"\n    Custom MoneyField for clean migrations while using dynamic currency settings\n    \"\"\"\n    \n    def __init__(self, **kwargs):\n        # detect if creating migration\n        if 'makemigrations' in sys.argv:\n            # remove currency information for a clean migration\n            kwargs['default_currency'] = ''\n            kwargs['currency_choices'] = []\n        else:\n            # set defaults\n            kwargs.update(money_kwargs())\n\n        # Set a minimum value validator\n        validators = kwargs.get('validators', [])\n\n        if len(validators) == 0:\n            validators.append(\n                MinMoneyValidator(0),\n            )\n\n        kwargs['validators'] = validators\n\n        super().__init__(**kwargs)\n\n    def formfield(self, **kwargs):\n        \"\"\" override form class to use own function \"\"\"\n        kwargs['form_class'] = InvenTreeMoneyField\n        return super().formfield(**kwargs)\n\n\nclass InvenTreeMoneyField(MoneyField):\n    \"\"\" custom MoneyField for clean migrations while using dynamic currency settings \"\"\"\n    def __init__(self, *args, **kwargs):\n        # override initial values with the real info from database\n        kwargs.update(money_kwargs())\n        super().__init__(*args, **kwargs)\n\n\nclass DatePickerFormField(forms.DateField):\n    \"\"\"\n    Custom date-picker field\n    \"\"\"\n\n    def __init__(self, **kwargs):\n\n        help_text = kwargs.get('help_text', _('Enter date'))\n        label = kwargs.get('label', None)\n        required = kwargs.get('required', False)\n        initial = kwargs.get('initial', None)\n\n        widget = forms.DateInput(\n            attrs={\n                'type': 'date',\n            }\n        )\n\n        forms.DateField.__init__(\n            self,\n            required=required,\n            initial=initial,\n            help_text=help_text,\n            widget=widget,\n            label=label\n        )\n\n\ndef round_decimal(value, places):\n    \"\"\"\n    Round value to the specified number of places.\n    \"\"\"\n\n    if value is not None:\n        # see https://docs.python.org/2/library/decimal.html#decimal.Decimal.quantize for options\n        return value.quantize(Decimal(10) ** -places)\n    return value\n\n\nclass RoundingDecimalFormField(forms.DecimalField):\n    def to_python(self, value):\n        value = super(RoundingDecimalFormField, self).to_python(value)\n        value = round_decimal(value, self.decimal_places)\n        return value\n\n    def prepare_value(self, value):\n        \"\"\"\n        Override the 'prepare_value' method, to remove trailing zeros when displaying.\n        Why? It looks nice!\n        \"\"\"\n\n        if type(value) == Decimal:\n            return InvenTree.helpers.normalize(value)\n        else:\n            return value\n\n\nclass RoundingDecimalField(models.DecimalField):\n    def to_python(self, value):\n        value = super(RoundingDecimalField, self).to_python(value)\n        return round_decimal(value, self.decimal_places)\n\n    def formfield(self, **kwargs):\n        defaults = {\n            'form_class': RoundingDecimalFormField\n        }\n\n        defaults.update(kwargs)\n\n        return super().formfield(**kwargs)\n", "path": "InvenTree/InvenTree/fields.py"}]}