diff --git a/runningmate/db.sqlite3 b/runningmate/db.sqlite3 index 53f754c..2c2a5bb 100644 Binary files a/runningmate/db.sqlite3 and b/runningmate/db.sqlite3 differ diff --git a/runningmate/mateapp/__pycache__/__init__.cpython-39.pyc b/runningmate/mateapp/__pycache__/__init__.cpython-39.pyc index eabcf3a..4ff7158 100644 Binary files a/runningmate/mateapp/__pycache__/__init__.cpython-39.pyc and b/runningmate/mateapp/__pycache__/__init__.cpython-39.pyc differ diff --git a/runningmate/mateapp/__pycache__/admin.cpython-39.pyc b/runningmate/mateapp/__pycache__/admin.cpython-39.pyc index a472a90..56cf083 100644 Binary files a/runningmate/mateapp/__pycache__/admin.cpython-39.pyc and b/runningmate/mateapp/__pycache__/admin.cpython-39.pyc differ diff --git a/runningmate/mateapp/__pycache__/apps.cpython-39.pyc b/runningmate/mateapp/__pycache__/apps.cpython-39.pyc index b442a6e..53724a5 100644 Binary files a/runningmate/mateapp/__pycache__/apps.cpython-39.pyc and b/runningmate/mateapp/__pycache__/apps.cpython-39.pyc differ diff --git a/runningmate/mateapp/__pycache__/models.cpython-39.pyc b/runningmate/mateapp/__pycache__/models.cpython-39.pyc index 1b97405..e0efc13 100644 Binary files a/runningmate/mateapp/__pycache__/models.cpython-39.pyc and b/runningmate/mateapp/__pycache__/models.cpython-39.pyc differ diff --git a/runningmate/mateapp/__pycache__/urls.cpython-39.pyc b/runningmate/mateapp/__pycache__/urls.cpython-39.pyc index cfb6f42..ebd4dce 100644 Binary files a/runningmate/mateapp/__pycache__/urls.cpython-39.pyc and b/runningmate/mateapp/__pycache__/urls.cpython-39.pyc differ diff --git a/runningmate/mateapp/__pycache__/views.cpython-39.pyc b/runningmate/mateapp/__pycache__/views.cpython-39.pyc index ff6a8d9..fb4cd56 100644 Binary files a/runningmate/mateapp/__pycache__/views.cpython-39.pyc and b/runningmate/mateapp/__pycache__/views.cpython-39.pyc differ diff --git a/runningmate/mateapp/forms.py b/runningmate/mateapp/forms.py new file mode 100644 index 0000000..d51643b --- /dev/null +++ b/runningmate/mateapp/forms.py @@ -0,0 +1,74 @@ +from django import forms +from .models import Post, Comment, FreePost, FreeComment + +class PostForm(forms.ModelForm): + class Meta: + model = Post + fields = '__all__' + + def __init__(self, *args, **kwargs): + super(PostForm, self).__init__(*args, **kwargs) + # 여기서 폼 추가하면 될 듯 싶은데 + self.fields['title'].widget.attrs = { + 'class': 'form-control', + 'placeholder': "강의명을 입력해주세요", # 입력 전 나오는 문구 + 'rows': 20 + } + + self.fields['body'].widget.attrs = { + 'class': 'form-control', + 'placeholder': "글 제목을 입력해주세요", + 'rows': 20, + 'cols' : 100 + } + + +class CommentForm(forms.ModelForm): + class Meta: + model = Comment + fields = ['comment'] + + def __init__(self, *args, **kwargs): + super(CommentForm, self).__init__(*args, **kwargs) + + self.fields['comment'].widget.attrs = { + 'class': 'form-control', + 'placeholder': "댓글을 입력해주세요", + 'rows': 10 + } + +# class FreePostForm(forms.ModelForm): +# class Meta: +# model = FreePost +# fields = ['title', 'body'] + +# def __init__(self, *args, **kwargs): +# super(FreePostForm, self).__init__(*args, **kwargs) + +# self.fields['title'].widget.attrs = { +# 'class': 'form-control', +# 'placeholder': "글 제목을 입력해주세요", +# 'rows': 20 +# } + +# self.fields['body'].widget.attrs = { +# 'class': 'form-control', +# 'placeholder': "글 제목을 입력해주세요", +# 'rows': 20, +# 'cols' : 100 +# } + + +class FreeCommentForm(forms.ModelForm): + class Meta: + model = FreeComment + fields = ['comment'] + + def __init__(self, *args, **kwargs): + super(FreeCommentForm, self).__init__(*args, **kwargs) + + self.fields['comment'].widget.attrs = { + 'class': 'form-control', + 'placeholder': "댓글을 입력해주세요", + 'rows': 10 + } \ No newline at end of file diff --git a/runningmate/mateapp/migrations/__pycache__/0001_initial.cpython-39.pyc b/runningmate/mateapp/migrations/__pycache__/0001_initial.cpython-39.pyc index 59eecff..7c28218 100644 Binary files a/runningmate/mateapp/migrations/__pycache__/0001_initial.cpython-39.pyc and b/runningmate/mateapp/migrations/__pycache__/0001_initial.cpython-39.pyc differ diff --git a/runningmate/mateapp/migrations/__pycache__/__init__.cpython-39.pyc b/runningmate/mateapp/migrations/__pycache__/__init__.cpython-39.pyc index 664ec2b..57418f5 100644 Binary files a/runningmate/mateapp/migrations/__pycache__/__init__.cpython-39.pyc and b/runningmate/mateapp/migrations/__pycache__/__init__.cpython-39.pyc differ diff --git a/runningmate/mateapp/models.py b/runningmate/mateapp/models.py index 363e372..4db4b1a 100644 --- a/runningmate/mateapp/models.py +++ b/runningmate/mateapp/models.py @@ -1,3 +1,4 @@ +from statistics import mode from django.db import models from django.contrib.auth.models import User @@ -11,15 +12,23 @@ class Post(models.Model): body = models.TextField() image = models.ImageField(upload_to = "post/", blank=True, null=True) -def __str__(self): - return self.title + def __str__(self): + return self.title + + def summary(self): + return self.body[:10] + +class Post(models.Model): + userName = models.CharField(max_length=20) # 이름 입력 최대 20글자 + userAbility = models.CharField(max_length=20) # 이름 입력 최대 20글자 + writer = models.ForeignKey(User,on_delete=models.CASCADE) # 작성자 누군지 + pub_date = models.DateTimeField() + body = models.TextField() + image = models.ImageField(upload_to = "post/", blank=True, null=True) + def __str__(self): + return self.title + + def summary(self): + return self.body[:10] -def summary(self): - return self.body[:10] -class Comment(models.Model): - content = models.TextField() - writer = models.ForeignKey(User, on_delete=models.CASCADE) - post = models.ForeignKey(Post ,on_delete=models.CASCADE, related_name ='comments') - created_at = models.DateTimeField(auto_now_add=True) - update_at = models.DateTimeField(auto_now=True) diff --git a/runningmate/mateapp/templates/mateapp/calendarDay.html b/runningmate/mateapp/templates/mateapp/calendarDay.html new file mode 100644 index 0000000..c7aaf73 --- /dev/null +++ b/runningmate/mateapp/templates/mateapp/calendarDay.html @@ -0,0 +1,8 @@ +