bypass validation for form field django
<pre><code>            class PostForm(forms.ModelForm):
                description = forms.CharField(widget=PagedownWidget(show_preview=False))
                class Meta:
                    model = Post
                    fields = [
                        'title',
                        'image',
                        'video',
                        'description',
                        'public',
                        'tags',
                        ]
</code></pre>

<p>I am trying to bypass the required field for 'video' but having difficulty doing so. Any suggestions would be appreciated.</p>

<p>this is my models.py, hopefully is should help with knowing how to go on this. </p>

<pre><code>            from django.db import models

            from django.db.models import Count, QuerySet, F
            from django.utils import timezone
            from django.conf import settings
            from django.contrib.contenttypes.models import ContentType
            from django.core.urlresolvers import reverse
            from django.db.models.signals import pre_save
            from django.utils.text import slugify
            from markdown_deux import markdown
            from django.utils.safestring import mark_safe
            from embed_video.fields import EmbedVideoField
            from taggit.managers import TaggableManager

            from comments.models import Comment

            def upload_location(instance, filename):
                return "%s/%s" %(instance.slug, filename)


            class Post(models.Model):
                user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1 )
                title = models.CharField(max_length=75)
                slug = models.SlugField(unique=True)
                video = EmbedVideoField()
                image = models.ImageField(
                        upload_to=upload_location,
                        null=True,
                        blank=True,
                        width_field="width_field",
                        height_field="height_field")
                height_field = models.IntegerField(default=0)
                width_field = models.IntegerField(default=0)
                description = models.TextField()
                tags = TaggableManager()
                public = models.BooleanField(default=False)
                updated = models.DateTimeField(auto_now_add=False, auto_now=True)
                created = models.DateTimeField(auto_now_add=True, auto_now=False)


                def __str__(self):
                    return self.title

                def get_absolute_url(self):
                    return reverse("posts:detail", kwargs={"slug": self.slug})

                class Meta:
                    ordering = ["-created", "-updated" ]

                def get_markdown(self):
                    description = self.description
                    markdown_text = markdown(description)
                    return mark_safe(markdown_text)

                @property
                def comments(self):
                    instance = self
                    qs = Comment.objects.filter_by_instance(instance)
                    return qs

                @property
                def get_content_type(self):
                    instance = self
                    content_type = ContentType.objects.get_for_model(instance.__class__)
                    return content_type


            def create_slug(instance, new_slug=None):
                    slug = slugify(instance.title)
                    if new_slug is not None:
                        slug = new_slug
                    qs = Post.objects.filter(slug=slug).order_by("-id")
                    exists = qs.exists()
                    if exists:
                        new_slug = "%s-%s" %(slug, qs.first().id)
                        return create_slug(instance, new_slug=new_slug)
                    return slug



            def pre_save_post_receiver(sender, instance, *args, **kwargs):
                if not instance.slug:
                    instance.slug = create_slug(instance)


            pre_save.connect(pre_save_post_receiver, sender=Post)
</code></pre>

<p>from <a href="https://pypi.python.org/pypi/django-embed-video" rel="nofollow">the docs</a> it looks like it should support empty now since version 0.3, i would suggest trying</p>

<pre><code>video = EmbedVideoField(null=True,blank=True)
</code></pre>

<p>the docs say it should function like a URL field, so just the standard notation should be all you need.</p>

<p>good luck!</p>

python django