diff --git a/stregsystem/admin.py b/stregsystem/admin.py index e87225ef..8b4620d7 100644 --- a/stregsystem/admin.py +++ b/stregsystem/admin.py @@ -17,6 +17,7 @@ NamedProduct, PendingSignup, Theme, + ProductNote, ) from stregsystem.templatetags.stregsystem_extras import money from stregsystem.utils import make_active_productlist_query, make_inactive_productlist_query @@ -362,6 +363,16 @@ def force_hide(modeladmin, request, queryset): actions = [force_unset, force_show, force_hide] +class ProductNoteAdmin(admin.ModelAdmin): + search_fields = ('active', 'text') + list_display = ( + 'active', + 'text', + ) + + actions = [toggle_active_selected_products] + + admin.site.register(LogEntry, LogEntryAdmin) admin.site.register(Sale, SaleAdmin) admin.site.register(Member, MemberAdmin) @@ -374,3 +385,4 @@ def force_hide(modeladmin, request, queryset): admin.site.register(MobilePayment, MobilePaymentAdmin) admin.site.register(PendingSignup) admin.site.register(Theme, ThemeAdmin) +admin.site.register(ProductNote, ProductNoteAdmin) diff --git a/stregsystem/fixtures/testdata.json b/stregsystem/fixtures/testdata.json index cb19fc9c..455a8f35 100644 --- a/stregsystem/fixtures/testdata.json +++ b/stregsystem/fixtures/testdata.json @@ -1,94 +1,74 @@ [ - { - "model": "auth.user", - "pk": 1, - "fields": { - "password": "pbkdf2_sha256$30000$ivRA8qABWClG$pxi2R4uyotlGpwa66RQuDOXFaO9JElQutMFJqXmnOdI=", - "is_superuser": true, - "username": "tester", - "first_name": "test", - "last_name": "testsen", - "is_staff": true - } - }, - { - "model": "auth.user", - "pk": 2, - "fields": { - "password": "pbkdf2_sha256$30000$ivRA8qABWClG$pxi2R4uyotlGpwa66RQuDOXFaO9JElQutMFJqXmnOdI=", - "is_superuser": true, - "username": "q", - "first_name": "q", - "last_name": "q", - "is_staff": true - } - }, - { - "model": "auth.user", - "pk": 3, - "fields": { - "password": "pbkdf2_sha256$30000$ivRA8qABWClG$pxi2R4uyotlGpwa66RQuDOXFaO9JElQutMFJqXmnOdI=", - "username": "nodough", - "first_name": "no", - "last_name": "dough" - } - }, - { - "model": "auth.user", - "pk": 4, - "fields": { - "password": "pbkdf2_sha256$30000$ivRA8qABWClG$pxi2R4uyotlGpwa66RQuDOXFaO9JElQutMFJqXmnOdI=", - "username": "lowdough", - "first_name": "low", - "last_name": "dough" - } - }, { "model": "stregsystem.member", "pk": 1, "fields": { + "active": true, "username": "tester", + "year": "2025", "firstname": "Test", "lastname": "Testsen", + "gender": "", "email": "plznospam@fklub.dk", + "want_spam": true, "balance": 13366037, - "notes": "This is a test user." + "undo_count": 0, + "notes": "This is a test user.", + "signup_due_paid": true } }, { "model": "stregsystem.member", "pk": 2, "fields": { + "active": true, "username": "q", + "year": "2025", "firstname": "q", "lastname": "q", + "gender": "", "email": "plznospam@fklub.dk", + "want_spam": true, "balance": 13366037, - "notes": "This is a test user with a short name for maximum testing speed." + "undo_count": 0, + "notes": "This is a test user with a short name for maximum testing speed.", + "signup_due_paid": true } }, { "model": "stregsystem.member", "pk": 3, "fields": { + "active": true, "username": "nodough", + "year": "2025", "firstname": "No", "lastname": "Dough", + "gender": "", "email": "plznospam@fklub.dk", + "want_spam": true, "balance": 0, - "notes": "This is a test user with no stregdollars." + "undo_count": 0, + "notes": "This is a test user with no stregdollars.", + "signup_due_paid": true } }, { "model": "stregsystem.member", "pk": 4, "fields": { + "active": true, "username": "lowdough", + "year": "2025", "firstname": "Low", "lastname": "Dough", + "gender": "", "email": "plznospam@fklub.dk", + "want_spam": true, "balance": 1500, - "notes": "This is a test user with only 15 stregdollars." + "undo_count": 0, + "notes": "This is a test user with only 15 stregdollars.", + "signup_due_paid": true } }, { @@ -217,6 +197,24 @@ "name": "Te" } }, + { + "model": "stregsystem.room", + "pk": 1, + "fields": { + "name": "testrummet", + "description": "127.0.0.1", + "notes": "" + } + }, + { + "model": "stregsystem.room", + "pk": 2, + "fields": { + "name": "maymayrummet", + "description": "svedigt", + "notes": "" + } + }, { "model": "stregsystem.product", "pk": 11, @@ -224,8 +222,17 @@ "name": "Stregdollar", "price": 100, "active": true, - "rooms": [1], - "categories": [14] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 14 + ], + "rooms": [ + 1 + ] } }, { @@ -235,8 +242,17 @@ "name": "Øl(Grøn, Classic, Gulddamer) (excl. pant)", "price": 750, "active": true, - "rooms": [1], - "categories": [3] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 3 + ], + "rooms": [ + 1 + ] } }, { @@ -246,8 +262,17 @@ "name": "Cocio (Mellem)", "price": 1818, "active": true, - "rooms": [1], - "categories": [12] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 12 + ], + "rooms": [ + 1 + ] } }, { @@ -257,7 +282,15 @@ "name": "Pant B (plastflasker under 1 liter)", "price": 150, "active": true, - "rooms": [1] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [], + "rooms": [ + 1 + ] } }, { @@ -267,9 +300,17 @@ "name": "Voksenvand (1 kop)", "price": 150, "active": true, + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, "caffeine_content_mg": 70, - "rooms": [1], - "categories": [6] + "categories": [ + 6 + ], + "rooms": [ + 1 + ] } }, { @@ -279,8 +320,15 @@ "name": "Limfjordsporter (excl. pant)", "price": 1000, "active": true, - "rooms": [1], - "categories": [] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [], + "rooms": [ + 1 + ] } }, { @@ -290,8 +338,17 @@ "name": "Søm", "price": 300, "active": true, - "rooms": [1], - "categories": [13] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 13 + ], + "rooms": [ + 1 + ] } }, { @@ -301,8 +358,17 @@ "name": "

Futtetyr

", "price": 33300, "active": true, - "rooms": [1], - "categories": [14] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 14 + ], + "rooms": [ + 1 + ] } }, { @@ -312,8 +378,17 @@ "name": "Mambo No. 8", "price": 800, "active": true, - "rooms": [1], - "categories": [7] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 7 + ], + "rooms": [ + 1 + ] } }, { @@ -323,8 +398,17 @@ "name": "

FLAN billet

", "price": 4269, "active": true, - "rooms": [1], - "categories": [5] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 5 + ], + "rooms": [ + 1 + ] } }, { @@ -334,8 +418,17 @@ "name": "Life potion (excl. pant)", "price": 1316, "active": true, - "rooms": [1], - "categories": [11] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 11 + ], + "rooms": [ + 1 + ] } }, { @@ -345,8 +438,17 @@ "name": "Kildevæld uden pant (excl. brus)\"", "price": 706, "active": true, - "rooms": [1], - "categories": [2] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 2 + ], + "rooms": [ + 1 + ] } }, { @@ -356,7 +458,15 @@ "name": "Pant A (glasflasker og metaldåser under 1 liter)", "price": 100, "active": true, - "rooms": [1] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [], + "rooms": [ + 1 + ] } }, { @@ -366,8 +476,17 @@ "name": "Grimbergen (excl. pant)", "price": 1900, "active": true, - "rooms": [1], - "categories": [3] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 3 + ], + "rooms": [ + 1 + ] } }, { @@ -377,8 +496,17 @@ "name": "Somersby (incl. pant)", "price": 1540, "active": true, - "rooms": [1], - "categories": [17] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 17 + ], + "rooms": [ + 1 + ] } }, { @@ -388,8 +516,17 @@ "name": "Apache attack helicopter", "price": 1280, "active": true, - "rooms": [1], - "categories": [10] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 10 + ], + "rooms": [ + 1 + ] } }, { @@ -399,8 +536,17 @@ "name": "Kakao (0,46 kop)", "price": 69, "active": true, - "rooms": [1], - "categories": [12] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 12 + ], + "rooms": [ + 1 + ] } }, { @@ -410,8 +556,17 @@ "name": "Sportycola (excl. pant)", "price": 600, "active": true, - "rooms": [1], - "categories": [2] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 2 + ], + "rooms": [ + 1 + ] } }, { @@ -421,8 +576,17 @@ "name": "Kinley (excl. pant)", "price": 680, "active": true, - "rooms": [1], - "categories": [1] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 1 + ], + "rooms": [ + 1 + ] } }, { @@ -432,8 +596,17 @@ "name": "Bober Øl (excl. pant x2)", "price": 650, "active": true, - "rooms": [1], - "categories": [3] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 3 + ], + "rooms": [ + 1 + ] } }, { @@ -443,8 +616,17 @@ "name": "

Månedens Øl


September: Bonk Beer", "price": 1460, "active": true, - "rooms": [1], - "categories": [4] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 4 + ], + "rooms": [ + 1 + ] } }, { @@ -454,8 +636,17 @@ "name": "Tebrev (Partibestemt smag)", "price": 90, "active": true, - "rooms": [1], - "categories": [18] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 18 + ], + "rooms": [ + 1 + ] } }, { @@ -465,8 +656,17 @@ "name": "Ramløse/ vand med brus (excl. pant)", "price": 808, "active": true, - "rooms": [1], - "categories": [2] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 2 + ], + "rooms": [ + 1 + ] } }, { @@ -476,8 +676,17 @@ "name": "Juice (Solita, Rynkeby)", "price": 1131, "active": true, - "rooms": [1], - "categories": [16] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 16 + ], + "rooms": [ + 1 + ] } }, { @@ -487,8 +696,51 @@ "name": "Faxe Kondi Pro", "price": 1600, "active": true, - "rooms": [1], - "categories": [1] + "start_date": null, + "quantity": 0, + "deactivate_date": null, + "alcohol_content_ml": 0, + "caffeine_content_mg": 0, + "categories": [ + 1 + ], + "rooms": [ + 1 + ] + } + }, + { + "model": "stregsystem.productnote", + "pk": 1, + "fields": { + "text": "
\r\n", + "active": true, + "background_color": "Yellow", + "text_color": "", + "start_date": "2025-01-14", + "end_date": "2125-01-14", + "comment": "", + "products": [ + 1903 + ], + "rooms": [] + } + }, + { + "model": "stregsystem.productnote", + "pk": 2, + "fields": { + "text": "Udgår!", + "active": true, + "background_color": "", + "text_color": "", + "start_date": "2025-01-14", + "end_date": "2125-01-14", + "comment": "", + "products": [ + 1879 + ], + "rooms": [] } }, { @@ -715,7 +967,6 @@ "product": 1891 } }, - { "model": "stregsystem.namedproduct", "pk": 18912, @@ -804,22 +1055,6 @@ "product": 1912 } }, - { - "model": "stregsystem.room", - "pk": 1, - "fields": { - "name": "testrummet", - "description": "127.0.0.1" - } - }, - { - "model": "stregsystem.room", - "pk": 2, - "fields": { - "name": "maymayrummet", - "description": "svedigt" - } - }, { "model": "stregsystem.sale", "pk": 1, @@ -827,7 +1062,7 @@ "member": 1, "product": 11, "room": 1, - "timestamp": "2017-03-13T12:52:52.142+00:00", + "timestamp": "2017-03-13T12:52:52.142Z", "price": 100 } }, @@ -838,7 +1073,7 @@ "member": 1, "product": 32, "room": 1, - "timestamp": "2017-03-13T12:54:12.423+00:00", + "timestamp": "2017-03-13T12:54:12.423Z", "price": 200 } }, @@ -847,21 +1082,1231 @@ "pk": 3, "fields": { "member": 1, - "product": 14, + "product": 42, "room": 1, - "timestamp": "2017-03-13T13:38:10.573+00:00", + "timestamp": "2017-03-13T13:38:10.573Z", "price": 300 } }, { - "model": "stregsystem.sale", + "model": "admin.logentry", + "pk": 1, + "fields": { + "action_time": "2025-01-13T23:27:21.879Z", + "user": 1, + "content_type": 13, + "object_id": "1", + "object_repr": "
\r\n