idk what is the problem but i liked your app it is a tutorial if is it may
i get the link thanks

‫في الخميس، 18 أبريل 2019 في 12:41 م تمت كتابة ما يلي بواسطة ‪Aakash
Baranwal‬‏ <‪baakash1...@gmail.com‬‏>:‬

> 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/CALr9hQ2hsoqjBaN7g5%2B6rqkEyRYrfDMHPan8tSvHG%3DQjhnfRbw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALr9hQ2hsoqjBaN7g5%2B6rqkEyRYrfDMHPan8tSvHG%3DQjhnfRbw%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/CAPkS-C57EYh-PS56ZUAM0wcuvUoZs5Lu_71x5fRWwoq2tM0uiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to