title: Django 1.11 CreateView pass URL parameters
body: <p>I am using Django 1.11 and I'm struggling to understand how I can pass URL parameters to a ModelForm using CreateView Class. I have 4 parameters in the URL (start_date, end_date, start_time, end_time) that i'm trying to pass to their relevant fields in the form. I'd really appreciate if anyone can point me in the right direction to figuring out how to solve this!</p>
  
  <p>The URL is created with the following function in my html file:</p>
  
  <pre><code>window.location.assign("/calendar/create?start_date="+start.format("YYYY-MM-DD")+"&amp;end_date="+end.format("YYYY-MM-DD")+"start_time="+start.format("h:mm A")+"&amp;end_time="+end.format("h:mm A"));
  </code></pre>
  
  <p>This opens from urls.py:</p>
  
  <pre><code>url(r'^calendar/create',views.CalendarCreate.as_view(),name='calendar_create'),
  </code></pre>
  
  <p>from views.py:</p>
  
  <pre><code>class CalendarCreate(CreateView):
      model = Event
      form_class = EventForm
  </code></pre>
  
  <p>from forms.py:</p>
  
  <pre><code>class EventForm(ModelForm):
  
      class Meta:
          model = Event
  </code></pre>
  
  <p>So far so good, my event_form.html opens with the form:
  <img src="https://i.stack.imgur.com/RhXjC.jpg" alt="form"></p>
  
  <p>and an example URL generated is:
  <a href="http://127.0.0.1:8000/calendar/create?start_date=2017-10-25&amp;end_date=2017-10-25start_time=4:00%20PM&amp;end_time=5:00%20PM" rel="nofollow noreferrer">http://127.0.0.1:8000/calendar/create?start_date=2017-10-25&amp;end_date=2017-10-25start_time=4:00%20PM&amp;end_time=5:00%20PM</a></p>
  
  <p>This is where I am stuck. From spending a number of days here in stackoverflow, googling, and trying numerous things I believe the solution involves <code>get_form_kwargs</code> or <code>get_context_data</code> or <code>form_valid</code> in <code>views.py</code> but it is possible I have just confused myself trying to work this out. Any help to get me on the right track will be greatly appreciated!</p>