Compare commits

..

No commits in common. "6e01b1939d5d3155ca8b88b93af419f4938a1c36" and "50ecaa2cc069988416276ce1c1f4e34d21df21f3" have entirely different histories.

7 changed files with 3 additions and 29 deletions

View File

@ -29,7 +29,7 @@ class StorageSerializer(serializers.HyperlinkedModelSerializer):
class Meta: class Meta:
model = parts_models.Storage model = parts_models.Storage
fields = ['url', 'id', 'name', 'verbose_name', 'parent_storage', 'responsible', 'template', 'full_path'] fields = ['url', 'id', 'name', 'parent_storage', 'responsible', 'full_path']
class ComponentSerializer(serializers.HyperlinkedModelSerializer): class ComponentSerializer(serializers.HyperlinkedModelSerializer):
package_data = PackageSerializerNoLink(source='package', read_only=True) package_data = PackageSerializerNoLink(source='package', read_only=True)

View File

@ -92,8 +92,7 @@ class MyTestForm(forms.Form):
pass pass
class ChangeStorageForm(forms.Form): class ChangeStorageForm(forms.Form):
storage_name = forms.CharField(label="Name", initial='') storage_name = forms.CharField(label="storage_name", initial='')
verbose_name = forms.CharField(label="Verbose Name", initial='')
responsible = AutocompleteForeingKeyField(api_search_url='user-list', responsible = AutocompleteForeingKeyField(api_search_url='user-list',
image_field_name=None, image_field_name=None,
name_field_name='username', name_field_name='username',

View File

@ -1,18 +0,0 @@
# Generated by Django 3.2.5 on 2024-11-16 11:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parts', '0011_auto_20241110_1242'),
]
operations = [
migrations.AddField(
model_name='storage',
name='verbose_name',
field=models.CharField(blank=True, max_length=100, null=True),
),
]

View File

@ -62,7 +62,6 @@ class Storage(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, unique=True) id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, unique=True)
name = models.CharField(max_length=100, validators=[storage_name_validator]) name = models.CharField(max_length=100, validators=[storage_name_validator])
verbose_name = models.CharField(max_length=100, null=True, blank=True)
parent_storage = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True) parent_storage = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True)
responsible = models.ForeignKey(get_user_model(), on_delete=models.SET_NULL, blank=True, null=True) responsible = models.ForeignKey(get_user_model(), on_delete=models.SET_NULL, blank=True, null=True)

View File

@ -484,7 +484,6 @@ class StockViewDetail(LoginRequiredMixin, BaseTemplateMixin, DetailView):
context['add_storage_form'] = add_storage_form context['add_storage_form'] = add_storage_form
change_storage_form = ChangeStorageForm() change_storage_form = ChangeStorageForm()
change_storage_form.fields['storage_name'].initial = self.object.name change_storage_form.fields['storage_name'].initial = self.object.name
change_storage_form.fields['verbose_name'].initial = self.object.verbose_name
change_storage_form.fields['responsible'].initial = self.object.responsible.id change_storage_form.fields['responsible'].initial = self.object.responsible.id
change_storage_form.fields['is_template'].initial = self.object.is_template change_storage_form.fields['is_template'].initial = self.object.is_template
context['change_storage_form'] = change_storage_form context['change_storage_form'] = change_storage_form
@ -499,7 +498,6 @@ class StockViewDetail(LoginRequiredMixin, BaseTemplateMixin, DetailView):
sub_name = f.cleaned_data['storage_name'] sub_name = f.cleaned_data['storage_name']
try: try:
Storage.objects.create(name=sub_name, Storage.objects.create(name=sub_name,
verbose_name=f.cleaned_data.get('verbose_name'),
parent_storage=self.object, parent_storage=self.object,
responsible=f.cleaned_data['responsible'], responsible=f.cleaned_data['responsible'],
is_template=f.cleaned_data['is_template'], is_template=f.cleaned_data['is_template'],
@ -516,7 +514,6 @@ class StockViewDetail(LoginRequiredMixin, BaseTemplateMixin, DetailView):
sub_name = f.cleaned_data['storage_name'] sub_name = f.cleaned_data['storage_name']
try: try:
self.object.name = f.cleaned_data['storage_name'] self.object.name = f.cleaned_data['storage_name']
self.object.verbose_name = f.cleaned_data.get('verbose_name')
self.object.responsible = f.cleaned_data['responsible'] self.object.responsible = f.cleaned_data['responsible']
self.object.is_template = f.cleaned_data['is_template'] self.object.is_template = f.cleaned_data['is_template']
self.object.save() self.object.save()

View File

@ -20,9 +20,6 @@
<div class="row"> <div class="row">
{% qr_from_text object.get_qr_code size="m" image_format="svg" %} {% qr_from_text object.get_qr_code size="m" image_format="svg" %}
</div> </div>
<div class="row">
<h4>{{storage.name}}{% if storage.verbose_name %}<small> ({{storage.verbose_name}})</small>{% endif %}</h4>
</div>
<div class="row"> <div class="row">
{% if object.parent_storage %} {% if object.parent_storage %}
<h1>Sub-Storages <a class="btn btn-secondary" href="{% url 'parts-stocks-detail' uuid=object.parent_storage.id %}">Parent Storage</a> {% else %} <h1>Sub-Storages <a class="btn btn-secondary" href="{% url 'parts-stocks-detail' uuid=object.parent_storage.id %}">Parent Storage</a> {% else %}

View File

@ -40,7 +40,7 @@
<a href="{% url 'parts-stocks-detail' uuid=storage.id %}" class="text-decoration-none"> <a href="{% url 'parts-stocks-detail' uuid=storage.id %}" class="text-decoration-none">
<li class="list-group-item list-group-item-action justify-content-between align-items-center d-flex"> <li class="list-group-item list-group-item-action justify-content-between align-items-center d-flex">
<div> <div>
<h5>{{storage.name}}{% if storage.verbose_name %}<small> ({{storage.verbose_name}})</small>{% endif %}</h5> <h5>{{storage.name}}</h5>
Responsible: {{ storage.responsible }} Responsible: {{ storage.responsible }}
</div> </div>
<span class="badge bg-primary rounded-pill">{{storage.get_total_stock_amount}}</span> <span class="badge bg-primary rounded-pill">{{storage.get_total_stock_amount}}</span>