top of page
teosafifenado

B-CAS-Power-Up-Minimum-Kit-Ver.2







pdf. [^6]: Covertor: [^7]: [^8]: [^9]: Q: Python code not executing in Django View I am having some trouble getting my Python view code to execute. I have tried the following methods but none of them have worked. Basically, I have a view where I want to display the current time. When a user visits the view, I want to add 1 to the value of seconds and update the current time in the database. I am trying to do this in an infinite loop but I know that's not the best approach. I have tried the following: def some_view(request): seconds = 0 while True: some_calculation_code_here seconds += 1 current_time = models.time.objects.filter(time_finished=False).order_by('-time_finished').first().time_finished current_time += 60 current_time += 1 if seconds >= 10: break else: continue form = TimeForm(request.POST or None, instance=request.user) if form.is_valid(): user_time = form.save(commit=False) user_time.save() return redirect('base:base_profile', pk=request.user.pk) else:


Related links:

6 views0 comments

Recent Posts

See All

Comments

Couldn’t Load Comments
It looks like there was a technical problem. Try reconnecting or refreshing the page.
bottom of page