if request.method == 'POST':
data = request.POST.copy() # so we can manipulate data
try:
name=request.POST['useremail'].split('@')[0]
data['username']=getUniqueValue(User,slugify(name),field_name='useremail')
except:
data['username'] = ''.join([choice(letters) for i in xrange(20)])
where What is the use of request.POST.copy()
?
Its use is found in the Django documentation: Request and response objects.
Returns a copy of the object, using copy.deepcopy() from the Python standard library. This copy will be mutable even if the original was not.