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": [
{
"url": "http://127.0.0.1:8000/category/wood-shop/",
"url": "http://tools-auth.protospace.ca/category/wood-shop/",
"tools": [
{
"url": "http://127.0.0.1:8000/tool/table-saw/",
"category": "http://127.0.0.1:8000/category/wood-shop/",
"url": "http://tools-auth.protospace.ca/tool/table-saw/",
"category": "http://tools-auth.protospace.ca/category/wood-shop/",
"name": "Table Saw",
"slug": "table-saw",
"info": "scary tool",
"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/",
"category": "http://127.0.0.1:8000/category/wood-shop/",
"url": "http://tools-auth.protospace.ca/tool/jointer/",
"category": "http://tools-auth.protospace.ca/category/wood-shop/",
"name": "Jointer",
"slug": "jointer",
"info": "goes buzz buzz",
"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",
"slug": "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": [
{
"url": "http://127.0.0.1:8000/tool/metal-lathe/",
"category": "http://127.0.0.1:8000/category/metal-shop/",
"url": "http://tools-auth.protospace.ca/tool/metal-lathe/",
"category": "http://tools-auth.protospace.ca/category/metal-shop/",
"name": "Metal Lathe",
"slug": "metal-lathe",
"info": "spins fast",
"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",
"slug": "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",
"profile": {
"url": "http://127.0.0.1:8000/profile/1/",
"url": "http://tools-auth.protospace.ca/profile/1/",
"user": "admin",
"authorized_tools": [
"table-saw",

View File

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