Please help:
I am using Django's Class based Generic CreateView:
url:
urls.py
urlpatterns = patterns("",
url(r'^(?P<slug>[a-z0-9_-]{3,50})/(?P<offer_id>\d+)/$', OrderCreateView.as_view(), name='form'),
)
There are clearly kwargs, that I use. My context processor picks them up and they can be used in my template, but
in the view, there is only one kwarg, which is the form: My print statement below has the following output:
{'form': <django.forms.models.UserAccountForm object at 0x111725e50>}
.view.py:
class OrderCreateView(CreateView):
template_name = 'order/order_register.html'
model = UserAccount
fields =('about',)
def get_context_data(self, *args, **kwargs):
print kwargs
context = super(OrderCreateView, self).get_context_data(*args, **kwargs)
courseevent = CourseEvent.objects.get(slug=kwargs['slug'])
How can I get related objects into my context with CreateView or what should I use instead. Any suggestions would be most welcome,
since I somehow struggle to understand this.
with kind regards and thanks in advance
Sabine