Migrating Likes and votes serializers
parent
cbec0caca2
commit
a51ca8c85a
|
@ -17,14 +17,14 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
|
|
||||||
from taiga.base.api import serializers
|
from taiga.base.api import serializers
|
||||||
|
from taiga.base.fields import Field, MethodField
|
||||||
|
|
||||||
|
|
||||||
class FanSerializer(serializers.ModelSerializer):
|
class FanSerializer(serializers.LightSerializer):
|
||||||
full_name = serializers.CharField(source='get_full_name', required=False)
|
id = Field()
|
||||||
|
username = Field()
|
||||||
|
full_name = MethodField()
|
||||||
|
|
||||||
class Meta:
|
def get_full_name(self, obj):
|
||||||
model = get_user_model()
|
return obj.get_full_name()
|
||||||
fields = ('id', 'username', 'full_name')
|
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
|
|
||||||
from taiga.base.api import serializers
|
from taiga.base.api import serializers
|
||||||
|
from taiga.base.fields import Field, MethodField
|
||||||
|
|
||||||
|
|
||||||
class VoterSerializer(serializers.ModelSerializer):
|
class VoterSerializer(serializers.LightSerializer):
|
||||||
full_name = serializers.CharField(source='get_full_name', required=False)
|
id = Field()
|
||||||
|
username = Field()
|
||||||
|
full_name = MethodField()
|
||||||
|
|
||||||
class Meta:
|
def get_full_name(self, obj):
|
||||||
model = get_user_model()
|
return obj.get_full_name()
|
||||||
fields = ('id', 'username', 'full_name')
|
|
||||||
|
|
Loading…
Reference in New Issue