String concat causing 'str' object has no attribute 'object'
I have a view like below:
I get the error: 'str' object has no attribute 'object'
it must have something to do with my string concat - what has gone wrong :)
thanks
def edit_skill_plan(request):
#t = skills.objects.get(skill_id='django_5158517')
skillid = request.POST.get('editbut')
user = request.user
t = skills.objects.get(creator=user, skill_id=skillid)
t.status = 'closed'
t.save() # this will update only
complete_date = datetime.today().strftime('%Y-%m-%d')
week_num = datetime.today().strftime('%V')
x = t.skill_name
user = request.user
points = t.points
cat = t.category
year = datetime.today().strftime('%Y')
status = str(request.user.username) +' completed the task: ' + str(x) + ' which was worth: ' + str(points) + ' points'
status.object.create(creator=user, status=status, status_date=complete_date)
Your last two line should be,
status_code = str(request.user.username) +' completed the task: ' + str(x) + ' which was worth: ' + str(points) + ' points'
status.object.create(creator=user, status=status_code, status_date=complete_date)