view

NoReverseMatch at /login.html/

NoReverseMatch at /login.html/ Question: this is the html form. I added action="{% url ‘create_user_view’ %}" to the html but the error says it is not a valid view. {% extends ‘base.html’ %} 2 3 {% block content %} 4 5 6 <div class="formbox"> 7 <form method="post" action="{% url ‘create_user_view’ %}"> 8 <h1 class="max"> Sign up …

Total answers: 1

There is error when trying to make order in django

There is error when trying to make order in django Question: When I try to order something, I keep getting this error: Here is my views.py if not request.user.is_authenticated: session = request.session cart = session.get(settings.CART_SESSION_ID) del session[‘cart’] else: customer = request.user.customer order, created = Order.objects.get_or_create( customer=customer, complete=False) order_product, created = OrderProduct.objects.get_or_create( order=order, ) order.save() messages.success(request, …

Total answers: 1

Django: Is possible use _set into the filter() method?

Django: Is possible use _set into the filter() method? Question: I’m working on my ListView called IndexView on my polls app. This view currently return the last five published questions (not including those set to be published in the future). But my view also publish Questions that don’t have any Choice, so I also want …

Total answers: 1

"save() got an unexpected keyword argument 'commit'" error in functional view

"save() got an unexpected keyword argument 'commit'" error in functional view Question: I got this error in my functional view: save() got an unexpected keyword argument ‘commit’ I’m try to save one object in database. ‘debtors’ is Many to Many field in models.py. forms.py class ExpenseForm(forms.ModelForm): class Meta: model = Expense fields = (‘amount’, ‘text’, …

Total answers: 1

Reload Variable Data from DB without restarting Django

Reload Variable Data from DB without restarting Django Question: I have a function in my Django Views.py and I use the data in another function but if a user changes True to False then I want to update it without having to restart Django. def update_list(): global processess processess = botactive.objects.filter(active=True).values_list(‘user’) update_list() I use processess …

Total answers: 1

Django Python Foreign Key issue

Django Python Foreign Key issue Question: I am showing "well" information linked to a specific project successfully based on well_id When I try to show drilling_tools in a similar fashion I get an error. Can anyone see what I am doing wrong in my views? def well_show(request, well_id): well = Well.objects.get(pk=well_id) drilling_tools = DrillingTool.objects.get(pk=well_id) return …

Total answers: 1

How to merge dataframe in dataframe

How to merge dataframe in dataframe Question: I am using Rest API. I need data in the form of a data frame. For this, I am using pandas. The query parameter of Rest API is connected to Database, so I am getting multiple outputs from Rest API. I want to merge these outputs in the …

Total answers: 1

Django Error (unsupported operand type(s) for +: 'float' and 'NoneType')

Django Error (unsupported operand type(s) for +: 'float' and 'NoneType') Question: I’m facing an issue of unsupported operand type(s) for +: ‘float’ and ‘NoneType’ actually I want to sum two different database column value in specific date range and one column has no value in this specific date range and that’s why I’m facing that …

Total answers: 1

Trying to convert a function based view to a generic detail view

Trying to convert a function based view to a generic detail view Question: Creating a comment system for a ticket django project. I’ve completed most of the functionality for the comment, except I’m not quite sure how to implement the POST method so that I can use the frontend to create comments. If I use …

Total answers: 1