-
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
1 parent
f8d3afe
commit 7cc6903
Showing
19 changed files
with
315 additions
and
22 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,3 +1,6 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Profile | ||
# Register your models here. | ||
|
||
admin.site.register(Profile) | ||
|
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,20 @@ | ||
from django import forms | ||
from django.contrib.auth.forms import UserChangeForm, UserCreationForm | ||
from django.contrib.auth import get_user_model | ||
from .models import Profile | ||
|
||
class CustomUserCreationForm(UserCreationForm): | ||
class Meta: | ||
model= get_user_model | ||
fields = UserCreationForm.Meta.fields | ||
|
||
class CustomUserChangeForm(UserCreationForm): | ||
class Meta: | ||
model = | ||
|
||
|
||
class ProfileForm(forms.ModelForm): | ||
class Meta: | ||
model = Profile | ||
fields = ['nickname', 'introduction', 'image'] | ||
|
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,20 @@ | ||
from django.db import models | ||
from imagekit.models import ProcessedImageField | ||
from imagekit.processors import ResizeToFill | ||
from django.conf import settings | ||
|
||
# Create your models here. | ||
class Profile(models.Model): | ||
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete =models.CASCADE) | ||
nickname = models.CharField(max_length=40, blank = True) | ||
introduction = models.TextField(blank = True) | ||
image = ProcessedImageField( | ||
blank = True, | ||
upload_to='profile/images', # 저장 위치 | ||
processors=[ResizeToFill(300,300)], # 처리할 작업 목록 | ||
format='JPEG', # 저장 포맷 | ||
options={'quality':90}, # 옵션 | ||
) | ||
|
||
class User(AbstractUser): | ||
followers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name= 'followers') |
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,15 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block container %} | ||
|
||
|
||
<div class ='container'> | ||
<h1>{{ people.username }}</h1> | ||
<div class="row"> | ||
{% for post in people.post_set.all %} | ||
<div class="col-4"> | ||
<img src="{{ post.image.url }}" class="img-fluid"/> | ||
</div> | ||
{% endblock %} | ||
</div> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
django/insta/accounts/templates/accounts/profile_update.html
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,13 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block container %} | ||
|
||
<h1>Profile Edit</h1> | ||
|
||
<form method = "POST"> | ||
{% csrf_token %} | ||
{{% bootstrap_form profile_form %}} | ||
<input type="submit" value="Submit"/> | ||
</form> | ||
|
||
{% endblock %} |
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,7 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block container %} | ||
|
||
<h1>User Edit</h1> | ||
|
||
{% endblock %} |
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,7 +1,21 @@ | ||
from django import forms | ||
from .models import Post | ||
from .models import Post, Comment, Image | ||
|
||
class PostForm(forms.ModelForm): | ||
class Meta: | ||
model = Post | ||
fields = ['content','image',] | ||
fields = ['content',] | ||
|
||
class CommentForm(forms.ModelForm): | ||
content = forms.CharField(label='', widget=forms.TextInput(attrs={'class':'form-control','placeholder':'댓글을 작성하세요'})) | ||
class Meta: | ||
model = Comment | ||
fields = ['content',] | ||
|
||
class ImageForm(forms.ModelForm): | ||
class Meta: | ||
model = Image | ||
fields = ['file',] | ||
|
||
ImageFormSet = forms.inlineformset_factory(Post, Image, form= ImageForm, extra=3) | ||
|
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,25 @@ | ||
# Generated by Django 2.1.8 on 2019-04-11 01:13 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('posts', '0004_auto_20190410_0510'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Comment', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('content', models.TextField()), | ||
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='posts.Post')), | ||
('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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 2.1.8 on 2019-04-11 05:51 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('posts', '0005_comment'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='post', | ||
name='like_user', | ||
field=models.ManyToManyField(related_name='like_posts', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 2.1.8 on 2019-04-15 00:41 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import imagekit.models.fields | ||
import posts.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('posts', '0006_post_like_user'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Image', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('file', imagekit.models.fields.ProcessedImageField(upload_to=posts.models.post_image_path)), | ||
], | ||
), | ||
migrations.RemoveField( | ||
model_name='post', | ||
name='image', | ||
), | ||
migrations.AddField( | ||
model_name='image', | ||
name='post', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='posts.Post'), | ||
), | ||
] |
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
Oops, something went wrong.