Mirco
What can I use then instead?
Override save method
M
Hello guys i have a bulk delete with huge data its take long time to filter().delete() so i tried query.raw.delete(query.db) and still the same problem any suggestions guys
virat kohli
Can any one day how to add subdomain to a django server
virat kohli
Example : if we run server in django it gives like this https://127.0.0.1.com/home But I need to like https:// example.127.0.0.1.com
Mohamed
how can I find good templates or projects for practice in python
Ehsan
Example : if we run server in django it gives like this https://127.0.0.1.com/home But I need to like https:// example.127.0.0.1.com
Blank the first ' ' in urls.py Do not fill it with 'home' Let it be blank
virat kohli
My question is : if a user enters a value then that value be a subdomain to the url
virat kohli
Example if user enters home then url should become like home.127.0.0.1:8000
virat kohli
Mahmood
virat kohli
Can I use this
Mahmood
Yes of course
virat kohli
Ok
virat kohli
Yes of course
Can you refer
virat kohli
How to do this
Mahmood
https://django-hosts.readthedocs.io/en/latest/#
Mahmood
You can see the documentation here
Mahmood
Can you refer
For dynamic use it's middleware based in the host
Mahmood
Example if user enters home then url should become like home.127.0.0.1:8000
don't use ip, use localhost instead Also be sure you added the host to the host file of your os
virat kohli
Ok thank you
Gaurav
I am using djoser for user registration but I want that some user will bypass the email verification
𝙼𝚊𝚜𝚑𝚑𝚞𝚛𝚋𝚎𝚔
Hi. Can you recommend a better text editor than ckeditor?
𝙼𝚊𝚜𝚑𝚑𝚞𝚛𝚋𝚎𝚔
What is the best ?
Anshu
Hi. Can you recommend a better text editor than ckeditor?
Django -summernote is also good and easy to configure
Starboi
Django -summernote is also good and easy to configure
Yes Exactly And can easily be used in the admin panel for bloggers
Mohamed
how can I find good templates or projects for practice in python
Ivanko ✙
Django is popular for making websites in 2023? Or not?
Riad
how default django url routing will perform if I use a separate frontend by django rest framework?
Dhanush
Invalid block tag on line 32: 'else', expected 'endblock'. Did you forget to register or load this tag?
Dhanush
can anyone help with this to rectify
Anurag
Invalid block tag on line 32: 'else', expected 'endblock'. Did you forget to register or load this tag?
Read python template documentation... Maybe you're using space somewhere or maybe you're initialising the template wrongly....
Anurag
Check for spaces... And any extra braces
Riad
class CourseMetaData(models.Model): name = models.CharField(max_length=400) price_total = models.FloatField() modules_total = models.IntegerField() price_per_module = models.FloatField( editable=False, default=price_total / modules_total) price_per_module is giving error saying: TypeError: unsupported operand type(s) for /: 'FloatField' and 'IntegerField' what can I do to automatically calculate the per module price by division?
Riad
def save(self, *args, **kwargs): self.price_per_module = round( (self.price_total / self.modules_total), 2) super().save(*args, **kwargs)
Rafael
or you can write the method for emample
Rafael
def calculate_price(self): self.price_per_module=self.price_total/float(self.mofule_total) and call it in save()
Maxim
editable is false
what does it matter?
Riad
what does it matter?
how price_per_module will take input when editable is False? also, can you suggest a better way?
Maxim
how price_per_module will take input when editable is False? also, can you suggest a better way?
If the value of a field is determined only by the values of other fields, why store it at all?
Hunter
How to log in website using email id instead of username in django, and why do we use AbstractUser ?
Mirco
How to log in website using email id instead of username in django, and why do we use AbstractUser ?
To override the default user model, imagine you wanna add other field or use, like in your case, email instead of username as auth field
DeViL
Hey I'm new here i know python But i don't know how to start django Can anyone help me . From where i should start And which course i should choose
Doragonsureiyā
Hey I'm new here i know python But i don't know how to start django Can anyone help me . From where i should start And which course i should choose
Check out PythonRes, a channel for Python resources - video courses, pdf books, tutorials and other info to help you learn Python.
.
Hey I'm new here i know python But i don't know how to start django Can anyone help me . From where i should start And which course i should choose
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Riad
Hey I'm new here i know python But i don't know how to start django Can anyone help me . From where i should start And which course i should choose
https://www.packtpub.com/product/django-4-by-example-fourth-edition/9781801813051 This is a very good book and updated
Munira
Hey guys I’m facing a problem related to django rest framework unit testing Code & error message : https://stackoverflow.com/questions/75096832/django-unit-test-database-connection-error I would be grateful if someone can help
Maxim
error occurs not in books.html
Suren
hi guys, I have a hotel booking form and that form shown in each hotel page. When someone fills it, a letter goes to me. But I want to send hotel name along in that letter. But the problem is I don't know how to get that hotel name. If I do this : hotel = Hotels.objects.get(pk=1) I am able to get hotel name. But how can I get pk automatically for that form? In this case I know exact pk, but what if I don't know? As this form will appear on any hotel.
.
hi guys, I have a hotel booking form and that form shown in each hotel page. When someone fills it, a letter goes to me. But I want to send hotel name along in that letter. But the problem is I don't know how to get that hotel name. If I do this : hotel = Hotels.objects.get(pk=1) I am able to get hotel name. But how can I get pk automatically for that form? In this case I know exact pk, but what if I don't know? As this form will appear on any hotel.
This depends on how you’re creating and processing the form data, but if you’re using modelform, overriding the save method might be helpful here. Like the second code in here, the saved object can be accessed in the save method like obj = super().save(commit=False) https://stackoverflow.com/a/67658893 Also this might give another idea how to get the same thing https://stackoverflow.com/a/7432793
Suren
This is what I mean, if I indicate pk, I am getting hotel name, but getting this pk automatically while using CrateView looks like a problem. I understand it is possible if not using class view
Suren
class HotelBooking(models.Model): name = models.CharField(max_length=255) email = models.EmailField() check_in = models.DateField(verbose_name='Check-in') check_out = models.DateField(verbose_name='Check-out') persons = models.IntegerField(default=1, verbose_name='Persons') message = models.TextField(blank=True) created_at = models.DateTimeField(auto_now_add=True)
Suren
I don't know if you used something like specifichotel<str:pk> in the urls with that you can get the specific hotel name as the pk and then insert it into the letter
my url looks like: path('booking/hotel/<slug:hotel_slug>/', HotelBookingFormView.as_view(), name='hotel_booking'),
Y
Hello I need some help, I had deploy my django project on pythonanywhere. But I want to update it with my github repository, I don't how process. Someone's can help me please?
Bhaghi
How deployment in django any videos please send me the video links
M
Guys what better for bulk delete performance postgresql or mongodb or maybe others 🤔 !?
Doragonsureiyā
Guys what better for bulk delete performance postgresql or mongodb or maybe others 🤔 !?
Do you want to use Django with MongoDB? Then you shouldn't Please read this article: https://daniel.feldroy.com/when-to-use-mongodb-with-django.html
Matvey
Hello everyone, can you tell me how to make a global action. I want to make a form in the admin panel by which you can upload a csv file and update (according to my scenario) all the data. I can't find a solution at all. UPD It is not tied to any entity. The data is abstract, I want to preprocess it and write down the result of my calculations