Skip to content

Commit 70a8ce4

Browse files
committed
Add app config for coffee app.
1 parent 48294d9 commit 70a8ce4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

example/coffee/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
default_app_config = "coffee.apps.CoffeeConfig"

example/coffee/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class CoffeeConfig(AppConfig):
5-
pass
5+
name = "example.coffee"

example/unicorn/components/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from django.shortcuts import redirect
22
from django.utils.functional import cached_property
33

4-
from coffee.models import Flavor
5-
64
from django_unicorn.components import HashUpdate, LocationUpdate, UnicornView
75
from django_unicorn.db import DbModel
86
from django_unicorn.decorators import db_model
7+
from example.coffee.models import Flavor
98

109

1110
class ModelsView(UnicornView):
@@ -14,7 +13,7 @@ class ModelsView(UnicornView):
1413
# Demonstrates how to use an instantiated model; class attributes get stored on
1514
# the class, so django-unicorn handles clearing this with `_resettable_attributes_cache`
1615
# in components.py
17-
class_flavor = Flavor()
16+
class_flavor: Flavor = Flavor()
1817

1918
def __init__(self, **kwargs):
2019
# Demonstrates how to use an instance variable on the class
@@ -41,6 +40,7 @@ def add_class_flavor(self):
4140
id = self.class_flavor.id
4241
self.reset()
4342

43+
# Note: this can cause inputs to appear to be cached
4444
return redirect(f"/models?createdId={id}")
4545

4646
@db_model

0 commit comments

Comments
 (0)