Hi Aakash, it' a bit difficult to read it in the email, could you paste it in a pastebin/github or any code snippet share app?
As far as I can see here, you are not adding the slug to the url in your website, so django cannot map your url to your code. It's better if you share a github repository or at least your urls.py. Cheers, El vie., 19 abr. 2019 a las 2:52, Aakash Baranwal (<baakash1...@gmail.com>) escribió: > Can anyone kindly suggest what I am doing wrong? > > Thanks > Aakash > > On Thu, Apr 18, 2019 at 3:10 PM Aakash Baranwal <baakash1...@gmail.com> > wrote: > >> Hi Everybody, >> >> This is my models.py file: >> >> from django.db.models.signals import pre_save >> from django.utils.text import slugify >> from django.db import models >> from django.conf import settings >> from django import forms >> >> # Create your models here. >> class Video(models.Model): >> Video_Description= models.CharField(max_length=500) >> slug = models.SlugField(unique=True) >> >> videofile= models.FileField(upload_to='videos/', null=True, >> verbose_name="") >> timestamp = models.DateTimeField(auto_now_add=True) >> >> class Meta: >> ordering = ['-timestamp'] >> >> def get_absolute_url(self): >> return reverse ("video:detail", kwargs={"slug":self.slug}) >> >> >> def __str__(self): >> return self.Video_Description + ": " + str(self.id) >> >> >> def create_slug(instance, new_slug=None): >> slug = slugify(instance.Video_Description) >> if new_slug is not None: >> slug = new_slug >> qs = Video.objects.filter(slug=slug).order_by("-id") >> exists = qs.exists() >> if exists: >> new_slug = "%s-%s" %(slug, qs.first().id) >> return create_slug(instance, slug=new_slug) >> return slug >> >> >> def pre_save_video_receiver(sender, instance, *args, **kwargs): >> if not instance.slug: >> instance.slug = create_slug(instance) >> >> pre_save.connect(pre_save_video_receiver, sender=Video) >> >> >> The problem I am facing is, slug field appears in the admin and >> unfortunately in the create page where I am uploading the videos. >> >> However, in the url it is not coming, also in the create page, I have to >> enter the slug manually. I want it to take whatever input was given to t >> video_description in the models.py file and it should disappear from the >> create post page. >> >> Kindly help me. >> >> With Kind Regards >> Aakash Baranwal >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CALr9hQ0zrzp5XiJ-Kca90iqtDJpDZ2oz6Wys6iOdVF4y5hfoZg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CALr9hQ0zrzp5XiJ-Kca90iqtDJpDZ2oz6Wys6iOdVF4y5hfoZg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF6hzDOuFBDOjCjmQr3dWLwR5j52en%2Bd8HqgpKqoXKuWfzEcpA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.