Skip to content

Commit

Permalink
Product: set unit fields to default=''
Browse files Browse the repository at this point in the history
  • Loading branch information
diefenbach committed Feb 21, 2025
1 parent faecc0d commit 2378c63
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 5.1.5 on 2025-02-21 11:33

from django.db import migrations, models

from lfs.catalog.models import LFS_BASE_PRICE_UNITS, LFS_PACKING_UNITS


class Migration(migrations.Migration):

dependencies = [
("catalog", "0006_alter_product_sku"),
]

operations = [
migrations.AlterField(
model_name="product",
name="base_price_unit",
field=models.CharField(
blank=True,
choices=LFS_BASE_PRICE_UNITS,
default="",
max_length=30,
verbose_name="Base price unit",
),
),
migrations.AlterField(
model_name="product",
name="packing_unit_unit",
field=models.CharField(
blank=True,
choices=LFS_PACKING_UNITS,
default="",
max_length=30,
verbose_name="Packing unit",
),
),
migrations.AlterField(
model_name="product",
name="template",
field=models.PositiveSmallIntegerField(
blank=True,
choices=[(0, "Default template"), (1, "Default template")],
null=True,
verbose_name="Product template",
),
),
]
8 changes: 6 additions & 2 deletions lfs/catalog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,9 @@ class Product(models.Model):

active_packing_unit = models.PositiveSmallIntegerField(_("Active packing"), default=0)
packing_unit = models.FloatField(_("Amount per packing"), blank=True, null=True)
packing_unit_unit = models.CharField(_("Packing unit"), blank=True, max_length=30, choices=LFS_PACKING_UNITS)
packing_unit_unit = models.CharField(
_("Packing unit"), blank=True, default="", max_length=30, choices=LFS_PACKING_UNITS
)

static_block = models.ForeignKey(
"StaticBlock", models.SET_NULL, verbose_name=_("Static block"), blank=True, null=True, related_name="products"
Expand Down Expand Up @@ -743,7 +745,9 @@ class Product(models.Model):

# Base price
active_base_price = models.PositiveSmallIntegerField(_("Active base price"), default=0)
base_price_unit = models.CharField(_("Base price unit"), blank=True, max_length=30, choices=LFS_BASE_PRICE_UNITS)
base_price_unit = models.CharField(
_("Base price unit"), blank=True, default="", max_length=30, choices=LFS_BASE_PRICE_UNITS
)
base_price_amount = models.FloatField(_("Base price amount"), default=0.0, blank=True, null=True)

# Manufacturer
Expand Down
10 changes: 5 additions & 5 deletions lfs/manage/templates/manage/manage_base.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{% load compress i18n sql static %}
{% load i18n sql static %}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>{% block title %}{% endblock %}</title>
<link rel="shortcut icon" href="{% static 'favicon.ico' %}" type="image/ico" />
{% compress css %}
{% comment %} {% compress css %} {% endcomment %}
<link rel="stylesheet" type="text/css" href="{% static 'lfs/bower_components/superfish/dist/css/superfish.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'lfs/bower_components/jquery-ui/themes/smoothness/jquery-ui.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'lfs/bower_components/jquery-ui/themes/smoothness/theme.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'lfs/bower_components/jgrowl/jquery.jgrowl.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'lfs/css/lfs.manage.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'lfs/css/lfs.manage-custom.css' %}" />
{% endcompress %}
{% comment %} {% endcompress %} {% endcomment %}
<script type="text/javascript">
var LFS_MANAGE_IMAGEBROWSER_URL = '{% url 'lfs_manage_imagebrowser' %}';
var STATIC_URL = '{% static '' %}';
</script>
{% compress js %}
{% comment %} {% compress js %} {% endcomment %}
<script type="text/javascript" src="{% static 'lfs/bower_components/jquery/dist/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'lfs/bower_components/jquery-ui/jquery-ui.js' %}"></script>
<script type="text/javascript" src="{% static 'lfs/bower_components/jquery-cookie/jquery.cookie.js' %}"></script>
Expand All @@ -37,7 +37,7 @@
<script type="text/javascript" src="{% static 'lfs/js/lfs.manage.js' %}"></script>
<script type="text/javascript" src="{% static 'lfs/js/urlify.js' %}"></script>
<script type="text/javascript" src="{% static 'lfs/js/lfs.manage-custom.js' %}"></script>
{% endcompress %}
{% comment %} {% endcompress %} {% endcomment %}
{% block javascript %}{% endblock %}
</head>
<body class="{% block section %}{% endblock %}">
Expand Down

0 comments on commit 2378c63

Please sign in to comment.