sandwitches 1.3.1__py3-none-any.whl → 1.4.1__py3-none-any.whl

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.
sandwitches/admin.py CHANGED
@@ -1,10 +1,28 @@
1
1
  from django.contrib import admin
2
- from .models import Recipe, Tag, Rating, Profile
2
+ from .models import Recipe, Tag, Rating
3
3
  from django.utils.html import format_html
4
+ from import_export import resources
5
+ from import_export.admin import ImportExportModelAdmin
6
+
7
+
8
+ class RecipeResource(resources.ModelResource):
9
+ class Meta:
10
+ model = Recipe
11
+
12
+
13
+ class TagResource(resources.ModelResource):
14
+ class Meta:
15
+ model = Tag
16
+
17
+
18
+ class RatingResource(resources.ModelResource):
19
+ class Meta:
20
+ model = Rating
4
21
 
5
22
 
6
23
  @admin.register(Recipe)
7
- class RecipeAdmin(admin.ModelAdmin):
24
+ class RecipeAdmin(ImportExportModelAdmin):
25
+ resource_classes = [RecipeResource]
8
26
  list_display = ("title", "uploaded_by", "created_at", "show_url")
9
27
  readonly_fields = ("created_at", "updated_at")
10
28
 
@@ -18,9 +36,14 @@ class RecipeAdmin(admin.ModelAdmin):
18
36
  url = obj.get_absolute_url()
19
37
  return format_html("<a href='{url}'>{url}</a>", url=url)
20
38
 
21
- show_url.short_description = "Recipe Link" # ty:ignore[unresolved-attribute]
39
+ show_url.short_description = "Recipe Link" # ty:ignore[unresolved-attribute, inconsistent-mro]
40
+
41
+
42
+ @admin.register(Tag)
43
+ class TagAdmin(ImportExportModelAdmin):
44
+ resource_classes = [TagResource]
22
45
 
23
46
 
24
- admin.site.register(Tag)
25
- admin.site.register(Rating)
26
- admin.site.register(Profile)
47
+ @admin.register(Rating)
48
+ class RatingAdmin(ImportExportModelAdmin):
49
+ resource_classes = [RatingResource]
sandwitches/models.py CHANGED
@@ -18,27 +18,6 @@ hashed_storage = HashedFilenameStorage()
18
18
  User = get_user_model()
19
19
 
20
20
 
21
- class Profile(models.Model):
22
- user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile")
23
- avatar = models.ImageField(upload_to="avatars", blank=True, null=True)
24
- avatar_thumbnail = ImageSpecField(
25
- source="avatar",
26
- processors=[ResizeToFill(100, 50)],
27
- format="JPEG",
28
- options={"quality": 60},
29
- )
30
- bio = models.TextField(blank=True)
31
- created_at = models.DateTimeField(auto_now_add=True)
32
- updated_at = models.DateTimeField(auto_now=True)
33
-
34
- class Meta:
35
- verbose_name = "Profile"
36
- verbose_name_plural = "Profiles"
37
-
38
- def __str__(self):
39
- return f"{self.user.username}'s Profile" # ty:ignore[possibly-missing-attribute]
40
-
41
-
42
21
  class Tag(models.Model):
43
22
  name = models.CharField(max_length=50, unique=True)
44
23
  slug = models.SlugField(max_length=60, unique=True, blank=True)
sandwitches/settings.py CHANGED
@@ -65,6 +65,7 @@ INSTALLED_APPS = [
65
65
  "django_tasks.backends.database",
66
66
  "debug_toolbar",
67
67
  "imagekit",
68
+ "import_export",
68
69
  "simple_history",
69
70
  ]
70
71
 
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sandwitches
3
- Version: 1.3.1
3
+ Version: 1.4.1
4
4
  Summary: Add your description here
5
5
  Author: Martyn van Dijke
6
6
  Author-email: Martyn van Dijke <martijnvdijke600@gmail.com>
7
7
  Requires-Dist: django-debug-toolbar>=6.1.0
8
8
  Requires-Dist: django-filter>=25.2
9
9
  Requires-Dist: django-imagekit>=6.0.0
10
+ Requires-Dist: django-import-export>=4.3.14
10
11
  Requires-Dist: django-ninja>=1.5.1
11
12
  Requires-Dist: django-simple-history>=3.10.1
12
13
  Requires-Dist: django-tasks>=0.10.0
@@ -1,5 +1,5 @@
1
1
  sandwitches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- sandwitches/admin.py,sha256=IIVQOr_CIXsdFXDPQoZ_c83DuqbHVnw4Ht9tAtmvLM0,870
2
+ sandwitches/admin.py,sha256=modm8vYd0CPainUUR5k0dxeO6vUu2GQuTT2kYhGeP5M,1399
3
3
  sandwitches/api.py,sha256=YDadi-3f2Oz4ia5gXo_rgXVZkZ6LAOiOWraz9bpZzho,2404
4
4
  sandwitches/asgi.py,sha256=cygnXdXSSVspM7ZXuj47Ef6oz7HSTw4D7BPzgE2PU5w,399
5
5
  sandwitches/forms.py,sha256=kYzotFafLyNli4a62PsL5hTqUXyno5jPqIwSv04vYaA,2749
@@ -13,8 +13,8 @@ sandwitches/migrations/0005_historicalrecipe_uploaded_by.py,sha256=xmYDXgBxjrQkb
13
13
  sandwitches/migrations/0006_profile.py,sha256=gzmxZWXmjldimYRdovuNouc2Y2idihg8UvEaU0ad_Ds,1558
14
14
  sandwitches/migrations/0007_alter_rating_score.py,sha256=hHdJqjTwq2afcBi7TRSBofAjedDxu5YybbXLhUoMGUg,588
15
15
  sandwitches/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- sandwitches/models.py,sha256=CxTwpzIej9hCnBb7kEF5bQAbw-lOvN_8w4SGplCDbFI,6484
17
- sandwitches/settings.py,sha256=vkIxkZpbaobuLeqYydckYSBJBrCAs-4royx7vym2bQA,5680
16
+ sandwitches/models.py,sha256=QWjaO7ONT_vsvEt_jJHJ6glUKtASC1ac_osIadhwbYM,5766
17
+ sandwitches/settings.py,sha256=hSwtZ_OSvwl8QIMs6wnNMLGvMrPADrQt1Swc5xOOcCg,5701
18
18
  sandwitches/storage.py,sha256=HIiOEDa_LhpsbhCUBNO-SlCZDUJOoANUbyDIbspEcoE,2325
19
19
  sandwitches/tasks.py,sha256=vB8HvaL4ooxowGOBxB-D2nOrKYfgc6kNaaTrEjpq1eY,3604
20
20
  sandwitches/templates/base.html,sha256=C9tUPfMKRvvdMqdDpE8ww21DH25bNktcVIwdrDEhajw,570
@@ -29,6 +29,6 @@ sandwitches/templatetags/markdown_extras.py,sha256=0ibmRzxE3r85x4k7kK71R-9UT0Cge
29
29
  sandwitches/urls.py,sha256=maKaIDfb_kNmMwrpS495TymuFnJJ6fbLoi5QRLjrFds,1582
30
30
  sandwitches/views.py,sha256=7ukWJHBflhAM02j_ZGuoqlBEgN2QnIIq4VhtnvRU1rM,5194
31
31
  sandwitches/wsgi.py,sha256=Eyncpnahq_4s3Lr9ruB-R3Lu9j9zBXqgPbUj7qhIbwU,399
32
- sandwitches-1.3.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
33
- sandwitches-1.3.1.dist-info/METADATA,sha256=xedDolZeXZG1WF2hCMJPfVaTBZt1xrzNAQzfeaD8QFo,731
34
- sandwitches-1.3.1.dist-info/RECORD,,
32
+ sandwitches-1.4.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
33
+ sandwitches-1.4.1.dist-info/METADATA,sha256=CFMI7vh40gUjzlwpDDSdJ19zMTY44Lo4jnLx0QE7X1g,775
34
+ sandwitches-1.4.1.dist-info/RECORD,,