Skip to content

Commit 5f9eed9

Browse files
committed
Add example models.
1 parent e10a52d commit 5f9eed9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

easy_maps_tests/test_app/models.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
11
#hello, testrunner!
2+
from django.db import models
3+
from django.contrib import admin
4+
5+
from easy_maps.models import Address
6+
from easy_maps.admin import AddressInlineAdmin
7+
8+
class Brand(models.Model):
9+
name = models.CharField(max_length=100)
10+
11+
def count(self):
12+
return self.shop_set.count()
13+
14+
class Shop(Address):
15+
brand = models.ForeignKey(Brand)
16+
17+
class ShopInlineAdmin(AddressInlineAdmin):
18+
model = Shop
19+
20+
class BrandAdmin(admin.ModelAdmin):
21+
list_display = ['name', 'count',]
22+
model = Brand
23+
inlines = [
24+
ShopInlineAdmin,
25+
]
26+
27+
admin.site.register(Brand, BrandAdmin)

0 commit comments

Comments
 (0)