1👍
Views are nothing more than functions in python so there isn’t anything stopping you from just passing the parameters into a separate view. Whether or not thats always a good thing is a different thing
def view_a(request):
# Logic here
return view_b(request)
Based on your comment:
What you’re trying to do seems like a long winded way of something that can be achieved with the .get
method
last_name = request.POST.get('last_name', generate_name())
What this would do is use the last name if its provided, otherwise it will generate one.
If you’re using a form, you can do the same kind of thing, just in the clean method
def clean_last_name(self):
last_name = self.cleaned_data.get('last_name')
if last_name:
return last_name
else:
return generate_name()
Source:stackexchange.com