lfs-samples 1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. lfs_samples-1.1/LICENSE.txt +27 -0
  2. lfs_samples-1.1/MANIFEST.in +4 -0
  3. lfs_samples-1.1/PKG-INFO +150 -0
  4. lfs_samples-1.1/README.md +118 -0
  5. lfs_samples-1.1/lfs_samples/__init__.py +0 -0
  6. lfs_samples-1.1/lfs_samples/admin.py +9 -0
  7. lfs_samples-1.1/lfs_samples/apps.py +24 -0
  8. lfs_samples-1.1/lfs_samples/locale/de/LC_MESSAGES/django.mo +0 -0
  9. lfs_samples-1.1/lfs_samples/locale/de/LC_MESSAGES/django.po +68 -0
  10. lfs_samples-1.1/lfs_samples/migrations/0001_initial.py +47 -0
  11. lfs_samples-1.1/lfs_samples/migrations/0002_issample.py +25 -0
  12. lfs_samples-1.1/lfs_samples/migrations/__init__.py +0 -0
  13. lfs_samples-1.1/lfs_samples/models.py +38 -0
  14. lfs_samples-1.1/lfs_samples/templates/lfs_samples/samples.html +56 -0
  15. lfs_samples-1.1/lfs_samples/templates/lfs_samples/samples_inline.html +161 -0
  16. lfs_samples-1.1/lfs_samples/templates/manage/products/tabs/_assigned_samples.html +88 -0
  17. lfs_samples-1.1/lfs_samples/templates/manage/products/tabs/_available_samples.html +88 -0
  18. lfs_samples-1.1/lfs_samples/templates/manage/products/tabs/_samples.html +103 -0
  19. lfs_samples-1.1/lfs_samples/templatetags/__init__.py +0 -0
  20. lfs_samples-1.1/lfs_samples/templatetags/lfs_samples_tags.py +68 -0
  21. lfs_samples-1.1/lfs_samples/tests/__init__.py +0 -0
  22. lfs_samples-1.1/lfs_samples/tests/settings.py +44 -0
  23. lfs_samples-1.1/lfs_samples/tests/test_manage_tab.py +26 -0
  24. lfs_samples-1.1/lfs_samples/tests/urls.py +9 -0
  25. lfs_samples-1.1/lfs_samples/urls.py +17 -0
  26. lfs_samples-1.1/lfs_samples/utils.py +49 -0
  27. lfs_samples-1.1/lfs_samples/views.py +388 -0
  28. lfs_samples-1.1/lfs_samples.egg-info/PKG-INFO +150 -0
  29. lfs_samples-1.1/lfs_samples.egg-info/SOURCES.txt +33 -0
  30. lfs_samples-1.1/lfs_samples.egg-info/dependency_links.txt +1 -0
  31. lfs_samples-1.1/lfs_samples.egg-info/not-zip-safe +1 -0
  32. lfs_samples-1.1/lfs_samples.egg-info/requires.txt +1 -0
  33. lfs_samples-1.1/lfs_samples.egg-info/top_level.txt +1 -0
  34. lfs_samples-1.1/setup.cfg +4 -0
  35. lfs_samples-1.1/setup.py +36 -0
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2015, Kai Diefenbach - IQ++
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ * Neither the name of the author nor the names of other contributors may
15
+ be used to endorse or promote products derived from this software
16
+ without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ include README.md LICENSE.txt
2
+ recursive-include lfs_samples/locale *
3
+ recursive-include lfs_samples/templates *
4
+
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: lfs-samples
3
+ Version: 1.1
4
+ Summary: Sample management for LFS
5
+ Home-page: https://github.com/diefenbach/lfs-samples
6
+ Author: Kai Diefenbach
7
+ Author-email: kai.diefenbach@iqpp.de
8
+ License: BSD-3-Clause
9
+ Keywords: django e-commerce online-shop
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: Framework :: Django
12
+ Classifier: Framework :: Django :: 5.2
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Requires-Python: >=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE.txt
19
+ Requires-Dist: django-lfs<2,>=1.0
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: keywords
27
+ Dynamic: license
28
+ Dynamic: license-file
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
32
+
33
+ # lfs-samples
34
+
35
+ Product samples for [django-lfs](https://pypi.org/project/django-lfs/) (LFS).
36
+
37
+ A shop manager marks products as samples and assigns them to other products. A customer can then order the sample
38
+ of a product from its product page.
39
+
40
+ ## What it does
41
+
42
+ - Adds a **Samples** tab to every product in the LFS management interface.
43
+ - Stores in its own tables:
44
+ - whether a product *is a sample*,
45
+ - which samples belong to a product,
46
+ - for variants: whether the variant has *its own samples* or uses those of its parent product.
47
+ - Provides template tags to show a product's samples in the shop.
48
+
49
+ A sample is an ordinary LFS product. When a customer orders it, it goes into the cart like any other product, with
50
+ its own price, stock and delivery settings. To give samples away for free, give the sample products a price of 0.
51
+
52
+ ## Requirements
53
+
54
+ - django-lfs >= 1.0, < 2 (which requires Django >= 5.2, < 6)
55
+ - Python >= 3.12
56
+
57
+ ## Installation
58
+
59
+ 1. Install the package:
60
+
61
+ ```sh
62
+ pip install lfs-samples
63
+ ```
64
+
65
+ 2. Add it to `INSTALLED_APPS`, after the LFS apps:
66
+
67
+ ```python
68
+ INSTALLED_APPS = [
69
+ # ... the LFS apps ...
70
+ "lfs_samples",
71
+ ]
72
+ ```
73
+
74
+ 3. Include its URLs in your project's `urls.py`. **This step is required:** the app registers the Samples tab as
75
+ soon as it is installed, and without these URLs every product page in the management interface fails with
76
+ `NoReverseMatch` for `lfs_manage_product_samples`.
77
+
78
+ ```python
79
+ from django.urls import include, path
80
+
81
+ urlpatterns = [
82
+ # ...
83
+ path("manage/", include("lfs.manage.urls")),
84
+ path("manage/samples/", include("lfs_samples.urls")),
85
+ ]
86
+ ```
87
+
88
+ The templates build all links with `{% url %}`, so any prefix works. `manage/samples/` is recommended: all
89
+ views of the app belong to the management interface (they require the `core.manage_shop` permission), so they
90
+ share its `manage/` prefix.
91
+
92
+ 4. Create the tables:
93
+
94
+ ```sh
95
+ python manage.py migrate lfs_samples
96
+ ```
97
+
98
+ ## Usage in the management interface
99
+
100
+ Open a product in the management interface and select the **Samples** tab.
101
+
102
+ - **Is sample**: marks the product as a sample. Only products marked this way can be assigned to other products.
103
+ A sample has no samples of its own, so the rest of the tab is hidden for it.
104
+ - **Active samples** (variants only): when checked, the variant uses the samples assigned to it. When unchecked,
105
+ the variant uses the samples of its parent product.
106
+ - **Selectable Samples / Selected Samples**: the left list shows the products marked as samples that are not yet
107
+ assigned (searchable by name or SKU, filterable by category); select some and add them to the product. The right
108
+ list shows the samples assigned to the product; select some and remove them.
109
+
110
+ ## Showing samples in the shop
111
+
112
+ Load the template tags with `{% load lfs_samples_tags %}`. They read `product` from the template context:
113
+
114
+ - `{% product_samples %}` sets `product_samples` to the list of the product's samples. For a variant without
115
+ active samples it returns the samples of the parent product.
116
+ - `{% is_sample %}` sets `is_sample` to whether the product is a sample.
117
+ - `{% ifproducthassamples %} ... {% else %} ... {% endifproducthassamples %}` renders its first part when samples
118
+ are assigned to the product itself (it does not fall back to the parent product).
119
+
120
+ LFS's product form accepts a sample directly: submitted with `action=add-sample-to-cart` and the sample's id as
121
+ `sample_id`, it adds the sample to the cart. Inside the product form, for example:
122
+
123
+ ```django
124
+ {% load i18n lfs_samples_tags %}
125
+ {% product_samples %}
126
+ {% with sample=product_samples.0 %}
127
+ {% if sample %}
128
+ <input type="hidden" name="sample_id" value="{{ sample.id }}">
129
+ <button type="submit" name="action" value="add-sample-to-cart">{% trans "Order a free sample" %}</button>
130
+ {% endif %}
131
+ {% endwith %}
132
+ ```
133
+
134
+ lfs-theme already shows this button on the product page when `lfs_samples` is installed.
135
+
136
+ The app comes with a German translation.
137
+
138
+ ## Development
139
+
140
+ The tests use pytest with pytest-django and an in-memory SQLite database (see `pytest.ini` and
141
+ `lfs_samples/tests/settings.py`). In an environment with django-lfs, pytest and pytest-django installed:
142
+
143
+ ```sh
144
+ pip install -e .
145
+ python -m pytest
146
+ ```
147
+
148
+ ## License
149
+
150
+ BSD 3-Clause License, see `LICENSE.txt`.
@@ -0,0 +1,118 @@
1
+ # lfs-samples
2
+
3
+ Product samples for [django-lfs](https://pypi.org/project/django-lfs/) (LFS).
4
+
5
+ A shop manager marks products as samples and assigns them to other products. A customer can then order the sample
6
+ of a product from its product page.
7
+
8
+ ## What it does
9
+
10
+ - Adds a **Samples** tab to every product in the LFS management interface.
11
+ - Stores in its own tables:
12
+ - whether a product *is a sample*,
13
+ - which samples belong to a product,
14
+ - for variants: whether the variant has *its own samples* or uses those of its parent product.
15
+ - Provides template tags to show a product's samples in the shop.
16
+
17
+ A sample is an ordinary LFS product. When a customer orders it, it goes into the cart like any other product, with
18
+ its own price, stock and delivery settings. To give samples away for free, give the sample products a price of 0.
19
+
20
+ ## Requirements
21
+
22
+ - django-lfs >= 1.0, < 2 (which requires Django >= 5.2, < 6)
23
+ - Python >= 3.12
24
+
25
+ ## Installation
26
+
27
+ 1. Install the package:
28
+
29
+ ```sh
30
+ pip install lfs-samples
31
+ ```
32
+
33
+ 2. Add it to `INSTALLED_APPS`, after the LFS apps:
34
+
35
+ ```python
36
+ INSTALLED_APPS = [
37
+ # ... the LFS apps ...
38
+ "lfs_samples",
39
+ ]
40
+ ```
41
+
42
+ 3. Include its URLs in your project's `urls.py`. **This step is required:** the app registers the Samples tab as
43
+ soon as it is installed, and without these URLs every product page in the management interface fails with
44
+ `NoReverseMatch` for `lfs_manage_product_samples`.
45
+
46
+ ```python
47
+ from django.urls import include, path
48
+
49
+ urlpatterns = [
50
+ # ...
51
+ path("manage/", include("lfs.manage.urls")),
52
+ path("manage/samples/", include("lfs_samples.urls")),
53
+ ]
54
+ ```
55
+
56
+ The templates build all links with `{% url %}`, so any prefix works. `manage/samples/` is recommended: all
57
+ views of the app belong to the management interface (they require the `core.manage_shop` permission), so they
58
+ share its `manage/` prefix.
59
+
60
+ 4. Create the tables:
61
+
62
+ ```sh
63
+ python manage.py migrate lfs_samples
64
+ ```
65
+
66
+ ## Usage in the management interface
67
+
68
+ Open a product in the management interface and select the **Samples** tab.
69
+
70
+ - **Is sample**: marks the product as a sample. Only products marked this way can be assigned to other products.
71
+ A sample has no samples of its own, so the rest of the tab is hidden for it.
72
+ - **Active samples** (variants only): when checked, the variant uses the samples assigned to it. When unchecked,
73
+ the variant uses the samples of its parent product.
74
+ - **Selectable Samples / Selected Samples**: the left list shows the products marked as samples that are not yet
75
+ assigned (searchable by name or SKU, filterable by category); select some and add them to the product. The right
76
+ list shows the samples assigned to the product; select some and remove them.
77
+
78
+ ## Showing samples in the shop
79
+
80
+ Load the template tags with `{% load lfs_samples_tags %}`. They read `product` from the template context:
81
+
82
+ - `{% product_samples %}` sets `product_samples` to the list of the product's samples. For a variant without
83
+ active samples it returns the samples of the parent product.
84
+ - `{% is_sample %}` sets `is_sample` to whether the product is a sample.
85
+ - `{% ifproducthassamples %} ... {% else %} ... {% endifproducthassamples %}` renders its first part when samples
86
+ are assigned to the product itself (it does not fall back to the parent product).
87
+
88
+ LFS's product form accepts a sample directly: submitted with `action=add-sample-to-cart` and the sample's id as
89
+ `sample_id`, it adds the sample to the cart. Inside the product form, for example:
90
+
91
+ ```django
92
+ {% load i18n lfs_samples_tags %}
93
+ {% product_samples %}
94
+ {% with sample=product_samples.0 %}
95
+ {% if sample %}
96
+ <input type="hidden" name="sample_id" value="{{ sample.id }}">
97
+ <button type="submit" name="action" value="add-sample-to-cart">{% trans "Order a free sample" %}</button>
98
+ {% endif %}
99
+ {% endwith %}
100
+ ```
101
+
102
+ lfs-theme already shows this button on the product page when `lfs_samples` is installed.
103
+
104
+ The app comes with a German translation.
105
+
106
+ ## Development
107
+
108
+ The tests use pytest with pytest-django and an in-memory SQLite database (see `pytest.ini` and
109
+ `lfs_samples/tests/settings.py`). In an environment with django-lfs, pytest and pytest-django installed:
110
+
111
+ ```sh
112
+ pip install -e .
113
+ python -m pytest
114
+ ```
115
+
116
+ ## License
117
+
118
+ BSD 3-Clause License, see `LICENSE.txt`.
File without changes
@@ -0,0 +1,9 @@
1
+ # django imports
2
+ from django.contrib import admin
3
+
4
+ # lfs imports
5
+ from .models import IsSample
6
+ from .models import ProductSamplesRelation
7
+
8
+ admin.site.register(ProductSamplesRelation)
9
+ admin.site.register(IsSample)
@@ -0,0 +1,24 @@
1
+ """App configuration: registers the samples tab on the product management page."""
2
+
3
+ from django.apps import AppConfig
4
+ from django.utils.translation import gettext_lazy as _
5
+
6
+
7
+ class LfsSamplesConfig(AppConfig):
8
+ """Adds the "Samples" tab to every product."""
9
+
10
+ name = "lfs_samples"
11
+ verbose_name = _("Samples")
12
+
13
+ def ready(self) -> None:
14
+ """Register the product tab."""
15
+ from lfs.manage.products.tabs import ProductTab, register_product_tab
16
+
17
+ register_product_tab(
18
+ ProductTab(
19
+ key="samples",
20
+ label=_("Samples"),
21
+ url_name="lfs_manage_product_samples",
22
+ template="manage/products/tabs/_samples.html",
23
+ )
24
+ )
@@ -0,0 +1,68 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE VERSION\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2016-01-07 11:41+0100\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "Language: \n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+
20
+ #: models.py:28
21
+ msgid "Sample"
22
+ msgstr "Muster"
23
+
24
+ #: templates/lfs_samples/samples.html:5
25
+ msgid "Samples"
26
+ msgstr "Muster"
27
+
28
+ #: templates/lfs_samples/samples.html:14
29
+ #| msgid "Sample"
30
+ msgid "Is sample"
31
+ msgstr "Ist Muster"
32
+
33
+ #: templates/lfs_samples/samples.html:30
34
+ msgid "Active samples"
35
+ msgstr "Muster aktiv"
36
+
37
+ #: templates/lfs_samples/samples_inline.html:33
38
+ msgid "Selectable Samples"
39
+ msgstr "Auswählbare Muster"
40
+
41
+ #: templates/lfs_samples/samples_inline.html:53
42
+ #: templates/lfs_samples/samples_inline.html:116
43
+ msgid "Active"
44
+ msgstr "Muster aktiv"
45
+
46
+ #: templates/lfs_samples/samples_inline.html:92
47
+ msgid "Add to samples"
48
+ msgstr "Zu Muster hinzufügen"
49
+
50
+ #: templates/lfs_samples/samples_inline.html:97
51
+ msgid "Selected Samples"
52
+ msgstr "Ausgewählte Muster"
53
+
54
+ #: templates/lfs_samples/samples_inline.html:156
55
+ msgid "Remove from samples"
56
+ msgstr "Von Muster entfernen"
57
+
58
+ #: views.py:187
59
+ msgid "Samples have been added."
60
+ msgstr "Muster wurden hinzugefügt."
61
+
62
+ #: views.py:214
63
+ msgid "Samples have been removed."
64
+ msgstr "Muster wurden entfernt."
65
+
66
+ #: views.py:241 views.py:268
67
+ msgid "Sample has been updated."
68
+ msgstr "Muster wurde aktualisiert."
@@ -0,0 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+ from __future__ import unicode_literals
3
+
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+ # The models point to catalog.Product, so the catalog's tables must exist first.
9
+ dependencies = [
10
+ ("catalog", "0001_initial"),
11
+ ]
12
+
13
+ operations = [
14
+ migrations.CreateModel(
15
+ name="ActivityState",
16
+ fields=[
17
+ ("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
18
+ (
19
+ "product",
20
+ models.ForeignKey(
21
+ related_name="active_samples",
22
+ verbose_name="Product",
23
+ to="catalog.Product",
24
+ on_delete=models.CASCADE,
25
+ ),
26
+ ),
27
+ ],
28
+ ),
29
+ migrations.CreateModel(
30
+ name="ProductSamplesRelation",
31
+ fields=[
32
+ ("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
33
+ (
34
+ "product",
35
+ models.ForeignKey(
36
+ related_name="products", verbose_name="Product", to="catalog.Product", on_delete=models.CASCADE
37
+ ),
38
+ ),
39
+ (
40
+ "sample",
41
+ models.ForeignKey(
42
+ related_name="samples", verbose_name="Sample", to="catalog.Product", on_delete=models.CASCADE
43
+ ),
44
+ ),
45
+ ],
46
+ ),
47
+ ]
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ from __future__ import unicode_literals
3
+
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+ dependencies = [
9
+ ("lfs_samples", "0001_initial"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.CreateModel(
14
+ name="IsSample",
15
+ fields=[
16
+ ("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
17
+ (
18
+ "product",
19
+ models.ForeignKey(
20
+ related_name="is_sample", verbose_name="Product", to="catalog.Product", on_delete=models.CASCADE
21
+ ),
22
+ ),
23
+ ],
24
+ ),
25
+ ]
File without changes
@@ -0,0 +1,38 @@
1
+ from django.db import models
2
+ from django.utils.translation import gettext_lazy as _
3
+ from lfs.catalog.models import Product
4
+
5
+
6
+ class IsSample(models.Model):
7
+ """
8
+ Stores whether a product is a sample.
9
+ """
10
+
11
+ product = models.ForeignKey(Product, verbose_name=_("Product"), related_name="is_sample", on_delete=models.CASCADE)
12
+
13
+ def __str__(self):
14
+ return "{} / {}".format(self.product.id, self.product.get_name())
15
+
16
+
17
+ class ActivityState(models.Model):
18
+ """
19
+ Stores whether a variant has activated samples.
20
+ """
21
+
22
+ product = models.ForeignKey(
23
+ Product, verbose_name=_("Product"), related_name="active_samples", on_delete=models.CASCADE
24
+ )
25
+
26
+
27
+ class ProductSamplesRelation(models.Model):
28
+ """
29
+ Relates samples to products.
30
+ """
31
+
32
+ product = models.ForeignKey(Product, verbose_name=_("Product"), related_name="products", on_delete=models.CASCADE)
33
+ sample = models.ForeignKey(Product, verbose_name=_("Sample"), related_name="samples", on_delete=models.CASCADE)
34
+
35
+ def __str__(self):
36
+ return "{} / {} <- {} / {}".format(
37
+ self.product.id, self.product.get_name(), self.sample.id, self.sample.get_name()
38
+ )
@@ -0,0 +1,56 @@
1
+ {% load i18n %}
2
+ {% load lfs_manage_tags lfs_samples_tags %}
3
+
4
+ <div id="samples">
5
+ <h2 class="heading-first">{% trans 'Samples' %}</h2>
6
+
7
+ <form id="samples-update-form"
8
+ action="{% url 'lfs_manage_update_is_sample' product.id %}"
9
+ method="post">
10
+ <input type="checkbox"
11
+ name="is_sample"
12
+ {% if is_sample %}checked="checked"{% endif %} />
13
+ <label for="is_sample">
14
+ {% trans 'Is sample' %}
15
+ </label>
16
+ <input class="ajax-save-button"
17
+ type="submit" value="{% trans "Update" %}" />
18
+ </form>
19
+
20
+ {% if not product.is_sample.exists %}
21
+ <hr style="margin: 20px 0" />
22
+ {% if product.is_variant %}
23
+ <form id="samples-update-form"
24
+ action="{% url 'lfs_manage_update_samples_state' product.id %}"
25
+ method="post">
26
+ <input type="checkbox"
27
+ name="samples_activity_state"
28
+ {% if has_active_samples %}checked="checked"{% endif %} />
29
+ <label for="active_samples">
30
+ {% trans 'Active samples' %}
31
+ </label>
32
+ <input class="ajax-save-button"
33
+ type="submit" value="{% trans "Update" %}" />
34
+ </form>
35
+ <div class="separator"></div>
36
+ {% endif %}
37
+
38
+ <form id="filter-samples-form"
39
+ action="{% url 'lfs_manage_samples_inline' product.id %}"
40
+ onsubmit="return false">
41
+ <input class="refresh-on-keyup" type="text" name="filter"/>
42
+
43
+ {% category_filter "refresh-on-change" "samples_category_filter" %}
44
+
45
+ <select class="refresh-on-change"
46
+ name="samples-amount">
47
+ {% for option in amount_options %}
48
+ <option {% if option.selected %}selected="selected"{% endif %}
49
+ value="{{ option.value }}">{{ option.value }}</option>
50
+ {% endfor %}
51
+ </select>
52
+
53
+ </form>
54
+ {{ samples_inline }}
55
+ {% endif %}
56
+ </div>