# Path: bamboo/models.py
# class Post(models.Model):
#     # author = models.ForeignKey('auth.User', null=True)
#     writer = models.CharField(max_length=100)
#     title = models.CharField(max_length=200)
#     text = models.TextField()
# #    created_date = models.DateTimeField(default=timezone.now)
#     published_date = models.DateTimeField(blank=True, null=True)
#     category = models.ForeignKey(Category, default=1, blank=True)
#     post_password = models.CharField(verbose_name=u'password', max_length=100, default='', help_text="글을 수정하거나 지울 때 사용할 비밀번호를 적어주세요")
# 
#     def publish(self):
#         self.published_date = timezone.now()
#         self.save()
# 
#     def __str__(self):
#         return self.title
# 
# class Comment(models.Model):
#     post = models.ForeignKey(
#         'bamboo.Post',
#         on_delete=models.CASCADE,
#         related_name='comments'
#     )
#     author = models.CharField(max_length=200)
#     text = models.TextField()
#     created_date = models.DateTimeField(default=timezone.now)
#     approved_comment = models.BooleanField(default=False)
# 
#     def approve(self):
#         self.approved_comment = True
#         self.save()
# 
#     def __str__(self):
#         return self.text


from django import forms
from .models import Post, Comment




class PostForm(forms.ModelForm):
    post_password = forms.CharField(widget=forms.PasswordInput)

    class Meta:
        model = Post
        fields = ('category', 'writer', 'post_password', 'title', 'text', )


class CommentForm(forms.ModelForm):

    class Meta:

# Path: bamboo/models.py
# class Post(models.Model):
#     # author = models.ForeignKey('auth.User', null=True)
#     writer = models.CharField(max_length=100)
#     title = models.CharField(max_length=200)
#     text = models.TextField()
# #    created_date = models.DateTimeField(default=timezone.now)
#     published_date = models.DateTimeField(blank=True, null=True)
#     category = models.ForeignKey(Category, default=1, blank=True)
#     post_password = models.CharField(verbose_name=u'password', max_length=100, default='', help_text="글을 수정하거나 지울 때 사용할 비밀번호를 적어주세요")
# 
#     def publish(self):
#         self.published_date = timezone.now()
#         self.save()
# 
#     def __str__(self):
#         return self.title
# 
# class Comment(models.Model):
#     post = models.ForeignKey(
#         'bamboo.Post',
#         on_delete=models.CASCADE,
#         related_name='comments'
#     )
#     author = models.CharField(max_length=200)
#     text = models.TextField()
#     created_date = models.DateTimeField(default=timezone.now)
#     approved_comment = models.BooleanField(default=False)
# 
#     def approve(self):
#         self.approved_comment = True
#         self.save()
# 
#     def __str__(self):
#         return self.text


# Path: bamboo/forms.py
from django import forms
from .models import Post, Comment




class PostForm(forms.ModelForm):
    post_password = forms.CharField(widget=forms.PasswordInput)

    class Meta:
        model = Post
        fields = ('category', 'writer', 'post_password', 'title', 'text', )


class CommentForm(forms.ModelForm):

    class Meta:

        model = Comment
