You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 8 година
1234567891011121314
  1. from api import models
  2. from rest_framework import serializers
  3. class PasswordSerializer(serializers.ModelSerializer):
  4. class Meta:
  5. model = models.Password
  6. fields = ('id', 'login', 'site', 'lowercase', 'uppercase', 'symbols', 'numbers', 'counter', 'length',
  7. 'created', 'modified')
  8. read_only_fields = ('created', 'modified')
  9. def create(self, validated_data):
  10. user = self.context['request'].user
  11. return models.Password.objects.create(user=user, **validated_data)