Commit b235eda7 authored by Rafal's avatar Rafal

add model, serializer

parent eed14a6e
...@@ -3,12 +3,13 @@ from django.db import models ...@@ -3,12 +3,13 @@ from django.db import models
# Create your models here. # Create your models here.
class Project(models.Model):
link_url = models.CharField(max_length=2000)
description = models.CharField(max_length=300, null=True)
class Beacon(models.Model): class Beacon(models.Model):
uuid = models.CharField(max_length=300, unique=True) uuid = models.CharField(max_length=300, unique=True)
name = models.CharField(max_length=300) name = models.CharField(max_length=300)
project = models.OneToOneField(Project) project = models.OneToOneField('Project')
description = models.CharField(max_length=300, null=True)
class Project(models.Model):
link_url = models.CharField(max_length=2000)
description = models.CharField(max_length=300, null=True) description = models.CharField(max_length=300, null=True)
__author__ = 'Rafal' from rest_framework import serializers
from models import Beacon
class BeaconSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Beacon
fields = ('id', 'url', 'title', 'source_url', 'content', 'image',
'activities')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment