Chimuti
hello guys can you help me i want to create a django timing app i have created the frontend with html now i wnat to allow the app to save data(time) for each user who starts the app
Anonymous
Thanks for suggestions.
You're welcome
Ibnu
hello guys, when i delete a message, it takes me to confirmatin page, but when i confirm it loades at the same page and not deleting.. if i tab ok 2 times i have to go back 3 times..so whats happening? i make it to redirect to home page
Ibnu
in my terminal "POST /delete/27/ HTTP/1.1" 200 248
Ibnu
can you send views?
def delete(request,pk): todo = Todo.objects.get(id=pk) form = TodoForm(instance=todo) if request.method == 'POST': form = TodoForm(request.POST , instance=todo) if form.is_valid(): form.delete() return redirect('home') return render(request , 'Todo/delete.html', { 'todo' : todo })
Ibnu
urls path('delete/<str:pk>/' , views.delete , name='delete') template(delete.html) <form method='POST' action="{% url 'delete' todo.id %}"> {% csrf_token %} <h2>want to delete this?</h2> <button type="submit">Yes</button> </form>
Ibnu
and the delete link.. <a href='{% url 'delete' todo.id %}' >Delete</a>
t
i have a Person model with first_name and last_name fields i have a search form that want to filter by names when user searching i want to be able to search with just first_name OR search with only last_name OR filter with both first_name and last_name these queries for "john wick" should return like this: "john" ==> returns "john wick" and other john's "wick" ==> returns "john wick" and other wick's "john wick" ==> returns only "john wick" these queries for "Kelvin van der Linde" that his first_name is "kelvin" and last_name is "van der Linde" should return: "Kelvin" ==> returns "Kelvin van der Linde" and other kelvin's "van der Linde" ==> returns all possible "van's" , "der's" , "Linde's" 😅🤷🏻‍♂️ please help me how to do this
t
my current code handles john OR wick but not john wick
t
forms.py class PersonSearchForm(forms.Form): search_term = forms.CharField(label="", required=True, widget=forms.TextInput(attrs={'method': 'POST', 'class': 'form-control me-2', 'placeholder': 'search people', 'id': 'login-username'})) def clean(self): cleaned_data = super().clean() search_term = cleaned_data.get('search_term') if search_term: words = search_term.lower().split() # Convert to lowercase and split into words queries = [Q(first_name__icontains=word) | Q(last_name__icontains=word) for word in words] self.cleaned_data['persons'] = Person.objects.filter(*queries).distinct() # Combine queries and remove duplicates return cleaned_data
Prakriti
Which platform to use to use generate api key in django? Is cloudinary okay?
Nana
Please anyone to help me fix NoreverseMatch at/ I have this link that take me to the user profile page. <a href="{% url 'user-profile' room.host.name %}">
Nana
I have the urls.py as urlpatterns =[ ('profile/<str:pk/', views.user_profile, name='user-profile'),]
Alex
can anyone help me out i am getting this error Add or change a related_name argument to the definition for 'mails.User.user_permissions' or 'auth.User.user_permissions'.
𝑴𝑼𝑯𝑨𝑴𝑴𝑬𝑻𝑨𝑳𝑰
What is django model forms
Believe
I have the urls.py as urlpatterns =[ ('profile/<str:pk>/', views.user_profile, name='user-profile'),]
Believe
>>> 'profile' == 'user-profile' False
He gave the name of the url so he is right i guess. But he forget to add a closing bracket so that was his mistake Error: The bracket after str:pk
Pritiranjan
@pritiranjanm
Issue in the template page or there is mismatch of name
Nana
Issue in the template page or there is mismatch of name
I'm still getting same error, it can't render the profile page. I accidentally deleted a user in the admin panel, from there that it shows such errors
Nana
I don't know how to fix that back
Pritiranjan
Try for another user
Anonymous
When i the first login it's show forbidden error. And same username & password through login 2nd time then I can login . Why this issue occurred?
Anonymous
i think you have not use the csrf token
Then why I can login 2nd time.
Anonymous
With same user & password
Alex
With same user & password
don't have any idea about this
Alex
KD bro can you solve my problem i am getting this error Add or change a related_name argument to the definition for 'mails.User.user_permissions' or 'auth.User.user_permissions'.
Alex
Is this are written in settings.py?
no, whenever i try to migrate my changes in model.py the terminal shows this error. even though I have declare the AUTH_USER_MODEL="mails.User"
David
I have a question any of you had the working with webRTC in Django with channels to create a videocall web app in Django ? T
Doragonsureiyā
I have a question any of you had the working with webRTC in Django with channels to create a videocall web app in Django ? T
Please don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello I need help on $z" Just ask about your problem directly! With a very high amount of people here the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Anant
i have one website which send user cart items to cook site so first i store the user items into database. this is my django code so please show me the error and my django model is class Order(models.Model): customer_id = models.ForeignKey(user_info, on_delete=models.CASCADE, default=None) items = models.JSONField() # Assuming you store the items as JSON in the order total_amount = models.DecimalField(max_digits = 10000,decimal_places=0) order_date = models.DateTimeField(auto_now_add=True) is_order_completed = models.BooleanField(default=False) def str(self): return f"Order for {self.customer_id.person_name} on {self.order_date}" please show me the error
Anant
/@csrf_exempt def cart(request): if request.method == "POST": try: # Parse the JSON data from the request body order_data = json.loads(request.body.decode('utf-8')) # Ensure that the order_data is not empty if not order_data: raise ValueError("Request body is empty or invalid") latest_customer = user_info.objects.order_by("-table_id").first() totalAmount = sum(item['price'] * item['quantity'] for item in order_data['items']) existing_order = Order.objects.filter(customer_id=latest_customer).first() print(existing_order) if existing_order: # Update existing order with new items and total amount existing_order.items.update(order_data) # Update the 'items' field existing_order.total_amount += totalAmount # Update the 'total_amount' field existing_order.save() # Save the changes to the existing order else: # Create a new order if it doesn't exist customer_order = Order.objects.create( customer_id=latest_customer, items=order_data, total_amount=totalAmount ) # Return a success response return JsonResponse({'success': True}) except Exception as e: # Return an error response if there's any exception return JsonResponse({'success': False, 'error': str(e)}) # For GET request, simply render the cart page return render(request, 'cart/cart.html')
☯️
Hello I'm using dj-rest-auth for authentication in DRF project and I want to use just login and logout features in project but dj-rest-auth has other urls and views such as password reset, confirm password and... how can I edit endpoint urls?
Roy
I need some help in learning django rest framework . Can anyone please tell me what are the topics i need to cover in djnago rest Framework. A normal Explanation or any documentation guide would be helpful . Thank you for your help
HR Utsha
Is there any React Django full stack course ??
🏅♐Mark
HR Utsha
Can you please give me the link
🏅♐Mark
Can you please give me the link
You just visit brototype website and register they will contact you
HR Utsha
Ok thank you
Roy
Learn how to serialized a data
Can I get some explanation. I would request a video tutorial if you know any . Thank you for your help
ΜυΗαΜΜαδ βαΣΗιΓ
Can I get some explanation. I would request a video tutorial if you know any . Thank you for your help
You can use codewithmosh to learn basic things how to build API with Django restframework. and also the Django restframework documentation will help you if you want more features.
ABHIRAM
Hi I want source code of tracking geolocation using phone number in django
ABHIRAM
Can u please help me out
Doragonsureiyā
Hi I want source code of tracking geolocation using phone number in django
This group is to help you on specific issues you have on YOUR code, so you have to show the code you wrote and explain where and why you are stuck... as simple as that
SALAMANDRA
How to delete Django on Ubuntu?
Mirco
SALAMANDRA
$ pip uninstall Django 3.2.12 Found existing installation: Django 3.2.12 Not uninstalling django at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'Django'. No files were found to uninstall. WARNING: Skipping 3.2.12 as it is not installed. I got such as answer
ΜυΗαΜΜαδ βαΣΗιΓ
cj
How to delete Django on Ubuntu?
firstly, how did you install it?
शिवांजली
I am getting value error like dtype=numeric not compatible...what I can do to solve this
SALAMANDRA
firstly, how did you install it?
Thorough terminal, with official website. I used the code
cj
Thorough terminal, with official website. I used the code
that one? then python -m pip uninstall django should work
juan camilo
Hi everyone) Do you know what is the best practice to use groups in Django? I have custom user with some roles (admin and content manager) I want create a group for content managers and when I create a user with rol content manager add he to the group
MH
Hi anyone have anay experience building public shopify app with django? Please share some guide like what should be the approach how we can do this?
Mahmuod
Anyone know how to create a one to many rel in django model django version 5.0