Re: Comment Form

2019-05-03 Thread Kayode Oladipo
Hello! Django has a simple solution to this. Go to your settings.py and define the url path to your login page. LOGIN_URL = "your url login path" Then in your views.py from django.contrib.auth.decorators import login_required Wrap the desired function with this decorator, @login_required def

Re: Comment Form Related issue

2019-04-26 Thread Robin Riis
its pretty much the same, you can check on class based view where you have CreateView and UpdateView and so on and i would recomend to add the following to models.py: updated_at = models.DateTimeField(null=True) updated_by = models.ForeignKey(get_user_model(), on_delete=models.CASCADE, null=True)

Re: Comment Form Related issue

2019-04-26 Thread Soumen Khatua
Okay,Could you tell me If any user want to update their comment it later the process is same or different? Thank You On Fri, Apr 26, 2019 at 5:31 PM Robin Riis wrote: > class Comment(models.Model): <--- in models.py > > class CommentForm(forms.ModelForm): <--- in forms.py > > def CommentVideo(

Re: Comment Form Related issue

2019-04-26 Thread Robin Riis
class Comment(models.Model): <--- in models.py class CommentForm(forms.ModelForm): <--- in forms.py def CommentVideo(request, pk): <--- in views.py and the video is another model i used since you said like youtube. :) Den fre 26 apr. 2019 kl 13:33 skrev Soumen Khatua : > yes,I'm new to django

Re: Comment Form Related issue

2019-04-26 Thread Soumen Khatua
yes,I'm new to django so let me check once. Thank You for your response. On Fri, Apr 26, 2019 at 4:36 PM Robin Riis wrote: > class Comment(models.Model): > > message = models.TextField() > > video = models.ForeignKey(Video, related_name='comments', > on_delete=models.CASCADE) > > created_at = mo

Re: Comment Form Related issue

2019-04-26 Thread Robin Riis
class Comment(models.Model): message = models.TextField() video = models.ForeignKey(Video, related_name='comments', on_delete=models.CASCADE) created_at = models.DateTimeField(auto_now_add=True) created_by = models.ForeignKey(get_user_model(), related_name='comments', on_delete=models.CASCADE)