Bläddra i källkod

make API reflect core interface

pull/342/head
Guillaume Vincent 8 år sedan
förälder
incheckning
0953c4d2a5
2 ändrade filer med 13 tillägg och 3 borttagningar
  1. +12
    -1
      api/models.py
  2. +1
    -2
      api/serializers.py

+ 12
- 1
api/models.py Visa fil

@@ -80,12 +80,23 @@ class Password(DateMixin):
symbols = models.BooleanField(default=True)
numbers = models.BooleanField(default=True)

counter = models.IntegerField(default=1)
length = models.IntegerField(default=12)
counter = models.IntegerField(default=1)

def __str__(self):
return str(self.id)

def options(self):
return {
'lowercase': self.lowercase,
'uppercase': self.uppercase,
'symbols': self.symbols,
'numbers': self.numbers,
'counter': self.counter,
'length': self.length,

}


class PasswordInfo(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)


+ 1
- 2
api/serializers.py Visa fil

@@ -61,8 +61,7 @@ class EntrySerializer(serializers.ModelSerializer):
class PasswordSerializer(serializers.ModelSerializer):
class Meta:
model = models.Password
fields = ('id', 'login', 'site', 'lowercase', 'uppercase', 'symbols', 'numbers', 'counter', 'length',
'created', 'modified')
fields = ('id', 'login', 'site', 'options', 'created', 'modified')
read_only_fields = ('created', 'modified')

def create(self, validated_data):


Laddar…
Avbryt
Spara