Hi,

I have a very basic and beginner's question, I have created a new 
`CreateView` for my project where you can submit an image with a title but 
it is not working although an image is attached. I am not getting any error 
the only thing I am receiving is `This field is required.` next to the 
`design`

Here is my models:
```
class Post(models.Model):
    title = models.TextField(max_length=100)
    design = models.ImageField(
        blank=False, null=True, upload_to='new designs')
    date_posted = models.DateTimeField(default=timezone.now)

    def __str__(self):
        return self.title
```
Here is the views.py:
```
class PostCreateView(CreateView):
    model = Post
    fields = ['title', 'design']
    success_url = 'post/post_list'
```
Here is the template:
```
{% extends "post/base.html" %} 
{% load crispy_forms_tags %} 
{% block content %}
<div class="content-section">
  <form method="POST">
    {% csrf_token %}
    <fieldset class="form-group">
      <legend class="border-bottom mb-4">Post</legend>
      {{ form|crispy }}
    </fieldset>
    <div class="form-group">
      <button class="btn btn-outline-info" type="submit">Submit</button>
    </div>
  </form>
</div>
{% endblock content %}
```

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8f18c719-0888-435b-bd89-8170e055ef11n%40googlegroups.com.

Reply via email to