-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref #161 - Configure project for postgresql and add models for User, …
…Post and EventPost
- Loading branch information
Kerem Zaman
committed
Nov 12, 2021
1 parent
4d241b7
commit 76fcd92
Showing
3 changed files
with
71 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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
|
||
class AppsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'apps' | ||
name = 'app.apps' |
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,3 +1,64 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
class User(models.Model): | ||
|
||
id = models.BigAutoField(primary_key=True) | ||
|
||
username = models.TextField() | ||
email = models.TextField() | ||
password = models.CharField(max_length=64) | ||
|
||
first_name = models.TextField() | ||
last_name = models.TextField() | ||
bio = models.TextField() | ||
|
||
birthday = models.DateTimeField() | ||
|
||
avatar = models.TextField() | ||
location = models.TextField() | ||
|
||
fav_sport_1 = models.TextField() | ||
fav_sport_2 = models.TextField() | ||
fav_sport_3 = models.TextField() | ||
|
||
badge_1 = models.TextField() | ||
badge_2 = models.TextField() | ||
badge_3 = models.TextField() | ||
|
||
privacy = models.BooleanField() | ||
|
||
|
||
class Post(models.Model): | ||
|
||
id = models.BigAutoField(primary_key=True) | ||
owner = models.ForeignKey(User, on_delete=models.CASCADE) | ||
|
||
content = models.TextField() | ||
title = models.TextField() | ||
|
||
creation_date = models.DateTimeField() | ||
location = models.TextField() | ||
|
||
class Meta: | ||
abstract = True | ||
|
||
|
||
class EventPost(Post): | ||
date = models.DateTimeField() | ||
duration = models.TimeField() | ||
|
||
sport = models.CharField(max_length=30) | ||
age_group = models.IntegerField() | ||
|
||
player_capacity = models.IntegerField() | ||
spec_capacity = models.IntegerField() | ||
players = models.IntegerField() | ||
spectators = models.IntegerField() | ||
|
||
skill_level = models.TextChoices('skill_level', 'Beginner Preintermediate Intermediate Advanced Expert') | ||
|
||
latitude = models.FloatField() | ||
longitude = models.FloatField() | ||
|
||
|
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