-
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.
- Loading branch information
geun lim
authored and
geun lim
committed
Jul 24, 2018
1 parent
e08c218
commit 2f99d86
Showing
5 changed files
with
112 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Generated by Django 2.0.7 on 2018-07-24 11:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Comment', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateField(auto_now_add=True)), | ||
('updated_at', models.DateField(auto_now=True)), | ||
('message', models.TextField()), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='Image', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateField(auto_now_add=True)), | ||
('updated_at', models.DateField(auto_now=True)), | ||
('file', models.ImageField(upload_to='')), | ||
('location', models.CharField(max_length=140)), | ||
('caption', models.TextField()), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
] |
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,19 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
class TimeStampedModel(models.Model): | ||
created_at = models.DateField(auto_now_add=True) | ||
updated_at = models.DateField(auto_now=True) | ||
|
||
class Meta: | ||
abstract = True | ||
|
||
class Image(TimeStampedModel): | ||
file = models.ImageField() | ||
location = models.CharField(max_length=140) | ||
caption = models.TextField() | ||
|
||
|
||
class Comment(TimeStampedModel): | ||
message = models.TextField() | ||
|
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,33 @@ | ||
# Generated by Django 2.0.7 on 2018-07-24 11:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='user', | ||
name='bio', | ||
field=models.TextField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name='user', | ||
name='gender', | ||
field=models.CharField(choices=[('male', 'Male'), ('female', 'Female'), ('not-specified', 'Not specified')], max_length=80, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='user', | ||
name='phone', | ||
field=models.CharField(max_length=140, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='user', | ||
name='website', | ||
field=models.URLField(null=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
from django.contrib.auth.models import AbstractUser | ||
from django.db.models import CharField | ||
from django.db import models | ||
from django.urls import reverse | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
|
||
class User(AbstractUser): | ||
|
||
GENDER_CHOICES = ( | ||
('male', 'Male'), | ||
('female','Female'), | ||
('not-specified', 'Not specified') | ||
) | ||
|
||
# First Name and Last Name do not cover name patterns | ||
# around the globe. | ||
name = CharField(_("Name of User"), blank=True, max_length=255) | ||
name = models.CharField(_("Name of User"), blank=True, max_length=255) | ||
website = models.URLField(null=True) | ||
bio = models.TextField(null=True) | ||
phone = models.CharField(max_length=140, null=True) | ||
gender = models.CharField(max_length=80, choices=GENDER_CHOICES, null=True) | ||
|
||
def get_absolute_url(self): | ||
return reverse("users:detail", kwargs={"username": self.username}) |