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
Rebison
Anonymous
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
Mr Komilov
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>
Ibnu
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
Anonymous
Ibnu
Anonymous
Anonymous
Anonymous
t
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?
Charly
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 %}">
Believe
Believe
Nana
I have the urls.py as
urlpatterns =[
('profile/<str:pk/', views.user_profile, name='user-profile'),]
Maxim
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
Pritiranjan
Believe
Pritiranjan
@pritiranjanm
Issue in the template page or there is mismatch of name
Nana
I don't know how to fix that back
Pritiranjan
Try for another user
Believe
Believe
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?
Alex
Anonymous
Anonymous
With same user & password
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'.
Believe
Believe
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
Anonymous
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
☯️
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
HR Utsha
Ok thank you
ABHIRAM
Hi I want source code of tracking geolocation using phone number in django
ABHIRAM
Can u please help me out
Roy
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
ΜυΗαΜΜαδ βαΣΗιΓ
शिवांजली
I am getting value error like dtype=numeric not compatible...what I can do to solve this
SALAMANDRA
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
MH