forked from CEOS-Developers/django-vote-14th
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Team-MailedIt/feature-candidate-and-vote
feat: Candidate, Vote 모델 및 관련 API 구현
- Loading branch information
Showing
6 changed files
with
116 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from django.contrib import admin | ||
from .models import User | ||
from .models import User, Candidate, Vote | ||
|
||
# Register your models here. | ||
admin.site.register(User) | ||
admin.site.register(User) | ||
admin.site.register(Candidate) | ||
admin.site.register(Vote) |
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,31 @@ | ||
# Generated by Django 3.0.8 on 2021-12-02 17:01 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('account', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Candidate', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=30)), | ||
('part', models.CharField(choices=[('FE', '프론트엔드'), ('BE', '백엔드')], max_length=2)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Vote', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('vote_candidate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.Candidate')), | ||
('vote_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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,14 @@ | ||
from django.urls import path | ||
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView | ||
from .views import RegisterAPIView, TestAPIView | ||
from .views import RegisterAPIView, CandidateListAPIView, CandidateDetailAPIView, VoteAPIView, TestAPIView | ||
|
||
urlpatterns = [ | ||
path("signin", TokenObtainPairView.as_view(), name="token_obtain_pair"), | ||
# 세션 연장하고 싶을 때 refresh token 사용 | ||
# path("token/refresh", TokenRefreshView.as_view(), name="token_refresh"), | ||
path("signup", RegisterAPIView.as_view()), | ||
path("candidate", CandidateListAPIView.as_view()), | ||
path("candidate/<int:pk>", CandidateDetailAPIView.as_view()), | ||
path("vote", VoteAPIView.as_view()), | ||
path("test", TestAPIView.as_view()), | ||
] |
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