CreateView set foreign key from URL parameter
There's no need to add the ipsum instance to the template context unless it's used in the template. Adding things to self is the cleanest way.

Using get_object_or_404 is appropriate if we require the ipsum instance to exist in order to save a lorem.

You should end up with something like this:

# urls.py

from django.urls import path

urlpatterns = [
    path('lorem/create/ipsum/&lt;int:ipsum_id&gt;/', LoremCreateView.as_view(), name='create'),
]


&nbsp;

# views.py

class LoremCreateView(CreateView):
    model = Lorem

    def dispatch(self, request, *args, **kwargs):
        """
        Overridden so we can make sure the `Ipsum` instance exists
        before going any further.
        """
        self.ipsum = get_object_or_404(Ipsum, pk=kwargs['ipsum_id'])
        return super().dispatch(request, *args, **kwargs)

    def form_valid(self, form):
        """
        Overridden to add the ipsum relation to the `Lorem` instance.
        """
        form.instance.ipsum = self.ipsum
        return super().form_valid(form)