-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pablo Grill
committed
May 4, 2020
1 parent
46822bd
commit fe9fa8a
Showing
13 changed files
with
134 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
from django.conf.urls import include, url | ||
from django.contrib import admin | ||
|
||
from questions.views import AnswerFeedbackApiView, QuestionApiView, FrequentQuestionsApiView | ||
from questions.views import (AnswerFeedbackApiView, CorrectApiView, QuestionApiView, | ||
FrequentQuestionsApiView, WrongApiView, FakeApiView) | ||
|
||
urlpatterns = [ | ||
url('admin/', admin.site.urls), | ||
url('question/', QuestionApiView.as_view()), | ||
url('feedback/', AnswerFeedbackApiView.as_view()), | ||
url('frequent-questions/', FrequentQuestionsApiView.as_view()) | ||
url('frequent-questions/', FrequentQuestionsApiView.as_view()), | ||
url('correct-answers/', CorrectApiView.as_view()), | ||
url('wrong-answers/', WrongApiView.as_view()), | ||
url('fake-answers/', FakeApiView.as_view()), | ||
] |
36 changes: 36 additions & 0 deletions
36
external-api/questions/migrations/0003_auto_20200504_2151.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 3.0.5 on 2020-05-04 21:51 | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('questions', '0002_auto_20200422_1920'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='answer', | ||
name='created_at', | ||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='question', | ||
name='created_at', | ||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name='answer', | ||
name='feedback', | ||
field=models.IntegerField(blank=True, choices=[(1, 'Respuesta Correcta'), (2, 'Respuesta Incorrecta'), (3, 'Noticia Falsa')], null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='question', | ||
name='question', | ||
field=models.CharField(blank=True, max_length=500, unique=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import Answer | ||
|
||
|
||
class QuestionInputSerializer(serializers.Serializer): | ||
question = serializers.CharField() | ||
|
||
|
||
class AnswerSerializer(serializers.Serializer): | ||
id = serializers.IntegerField() | ||
title = serializers.CharField() | ||
context = serializers.CharField() | ||
answer = serializers.CharField() | ||
answer_start_index = serializers.CharField() | ||
answer_end_index = serializers.CharField() | ||
date = serializers.CharField() | ||
source = serializers.CharField() | ||
url = serializers.CharField() | ||
|
||
|
||
class FeedbackInputSerializer(serializers.Serializer): | ||
answer_id = serializers.IntegerField() | ||
feedback = serializers.ChoiceField(choices=Answer.FEEDBACK_CHOICES) | ||
|
||
|
||
class FeedbackSerializer(serializers.Serializer): | ||
id = serializers.IntegerField() | ||
question = serializers.CharField(source='question.question') | ||
context = serializers.CharField() | ||
answer = serializers.CharField() | ||
answer_date = serializers.DateTimeField(source='created_at') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Does the api change the code?