Sobes.tech

# There is a base template base.html # You need to create a new page that will inherit from the base template. # And it will have a title 'new page' # The content of this new page can be anything (we'll denote it with ellipsis)

Senior
206

What data type should be used to store monetary amounts in a database?

Senior
172

# Task. Given a list, reverse it #z = [1, 2, 3, 4, 5] # The result should be the list [5, 4, 3, 2, 1] # You need to implement a function that reverses the list. # Built-in methods (z[::-1], z.reverse(), reversed(z)) cannot be used. # You cannot create new lists. It is recommended to use a for loop def reverse(lst: list) -> list: ...

Senior
169

What objects in Python can be used as dictionary keys?

Senior
162

class Order(models.Model): status = models.CharField(verbose_name='Статус') completed_date = models.DateTimeField(null=True) def send_message(order: Order): # Отправляет сообщение в ТГ ... def check_cancelled_orders(): batch = 10000 offset = 0 while True: cancelled_orders = Order.objects.filter( status='cancelled', completed_date__is_null=True )[offset: offset+batch] if not cancelled_orders: break offset += batch completed_date = now() for order in cancelled_orders: send_message(order) Order.objects.bulk_update(cancelled_orders, ['completed_date'])

Senior
145

What is the difference between `select_related` and `prefetch_related` in Django?

Senior
87

# Write a decorator that counts the number of function calls and outputs # the name of the function with the highest call count and the current function def call_count(): ...

Senior
85