Add MAC address field to tools

This commit is contained in:
Tanner Collin 2018-09-17 18:43:54 -06:00
parent d5c16bd11b
commit 72e783545f
2 changed files with 18 additions and 14 deletions

View File

@ -66,49 +66,52 @@ Example response:
{ {
"categories": [ "categories": [
{ {
"url": "http://127.0.0.1:8000/category/wood-shop/", "url": "http://tools-auth.protospace.ca/category/wood-shop/",
"tools": [ "tools": [
{ {
"url": "http://127.0.0.1:8000/tool/table-saw/", "url": "http://tools-auth.protospace.ca/tool/table-saw/",
"category": "http://127.0.0.1:8000/category/wood-shop/", "category": "http://tools-auth.protospace.ca/category/wood-shop/",
"name": "Table Saw", "name": "Table Saw",
"slug": "table-saw", "slug": "table-saw",
"info": "scary tool", "info": "scary tool",
"wiki_id": 123, "wiki_id": 123,
"photo": "http://127.0.0.1:8000/media/floodgf.jpg" "photo": "http://tools-auth.protospace.ca/media/DSC00125.jpg",
"mac": "2C3AE843A15F"
}, },
{ {
"url": "http://127.0.0.1:8000/tool/jointer/", "url": "http://tools-auth.protospace.ca/tool/jointer/",
"category": "http://127.0.0.1:8000/category/wood-shop/", "category": "http://tools-auth.protospace.ca/category/wood-shop/",
"name": "Jointer", "name": "Jointer",
"slug": "jointer", "slug": "jointer",
"info": "goes buzz buzz", "info": "goes buzz buzz",
"wiki_id": 1, "wiki_id": 1,
"photo": "http://127.0.0.1:8000/media/uq4ldzsp4bu01.jpg" "photo": "http://tools-auth.protospace.ca/media/uq4ldzsp4bu01.jpg",
"mac": "2C3AE8439EAD"
} }
], ],
"name": "Wood Shop", "name": "Wood Shop",
"slug": "wood-shop", "slug": "wood-shop",
"info": "protospace wood shop", "info": "protospace wood shop",
"photo": "http://127.0.0.1:8000/media/photo_2018-05-06_13-26-59.jpg" "photo": "http://tools-auth.protospace.ca/media/ps-wood-shop.jpg"
}, },
{ {
"url": "http://127.0.0.1:8000/category/metal-shop/", "url": "http://tools-auth.protospace.ca/category/metal-shop/",
"tools": [ "tools": [
{ {
"url": "http://127.0.0.1:8000/tool/metal-lathe/", "url": "http://tools-auth.protospace.ca/tool/metal-lathe/",
"category": "http://127.0.0.1:8000/category/metal-shop/", "category": "http://tools-auth.protospace.ca/category/metal-shop/",
"name": "Metal Lathe", "name": "Metal Lathe",
"slug": "metal-lathe", "slug": "metal-lathe",
"info": "spins fast", "info": "spins fast",
"wiki_id": 42, "wiki_id": 42,
"photo": "http://127.0.0.1:8000/media/intro-metal-shop-vali-steele-97.jpeg" "photo": "http://tools-auth.protospace.ca/media/lathe.jpeg",
"mac": "ABCDEF000003"
} }
], ],
"name": "Metal Shop", "name": "Metal Shop",
"slug": "metal-shop", "slug": "metal-shop",
"info": "protospace metal shop", "info": "protospace metal shop",
"photo": "http://127.0.0.1:8000/media/photo_2018-05-08_17-57-02.jpg" "photo": "http://tools-auth.protospace.ca/media/metal-shop02.jpg"
} }
] ]
} }
@ -127,7 +130,7 @@ Example response:
{ {
"username": "admin", "username": "admin",
"profile": { "profile": {
"url": "http://127.0.0.1:8000/profile/1/", "url": "http://tools-auth.protospace.ca/profile/1/",
"user": "admin", "user": "admin",
"authorized_tools": [ "authorized_tools": [
"table-saw", "table-saw",

View File

@ -17,6 +17,7 @@ class Tool(models.Model):
info = models.TextField(max_length=1024, blank=True) info = models.TextField(max_length=1024, blank=True)
wiki_id = models.IntegerField() wiki_id = models.IntegerField()
photo = models.ImageField(blank=True) photo = models.ImageField(blank=True)
mac = models.CharField(max_length=12)
def __str__(self): def __str__(self):
return self.name return self.name