Jay
https://dpaste.org/iAq6R manager.py
z
Does anyone know how to show ads on django?
z
Not google ads but users will create their own ads.
Jay
show model
can you please share your views on this
Jay
TypeError: User() got unexpected keyword arguments: 'is_staff', 'is_active'
Jay
while creating superuser
Firdaus
TypeError: User() got unexpected keyword arguments: 'is_staff', 'is_active'
- is_staff - is_active Have you created those fields in your User model? I think AbstractBaseUser does not provide those fields. And don not forget make and run migrations.
Firdaus
fields and methods provided by AbstractBaseUser ==> https://docs.djangoproject.com/en/4.1/topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser
Jay
trying your tip
Jay
AbstractBaseUser provides those fields\
Jay
fields*
Андрей
Hello, tell me I use drf in my django project to display and use viewsets.ViewSet , but the path is not displayed in the Root Api, the paths are prescribed normally in drf-ysng, how can I fix it, I searched the documentation and did not find an answer
Georg
hello. How can I suppress None values in django templates ?
Georg
Are there any options like "suppress nones" or similar?
Samoiddin
Hi guys . I'm trying to setup my site from HTTP to HTTPS on AWS Elastic Beanstalk Can anyone help me ?
Abhie
hello. How can I suppress None values in django templates ?
Use if ,else condition this might fulfill ur requirement
Georg
I have two models: Master and Detail, where Master<—Detail I can go like this: detail.master if detail is a single model instance but how can I get this: details.somemethod('master') to get a Queryset of Master objects ?
Georg
Use if ,else condition this might fulfill ur requirement
I know this way. But I thought about global option to suppress Nones
Georg
Use if ,else condition this might fulfill ur requirement
better to do like this myavlue|default:'' or create a short tag ifnull or ns
Yooo
Which one is best for django for learning Coding blocks or durgasoft?
cj
Which one is best for django for learning Coding blocks or durgasoft?
none of them, use the official tutorial instead
Doragonsureiyā
Which one is best for django for learning Coding blocks or durgasoft?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
jaxx
How to group by foreignkey and show its values
Альберт
hi all! Has anyone made Ajax requests? I need the messages sent by me to load without refreshing the browser page
Irshod
hello. how to make html tabs dynamically using django?
Hyperboria
hello, im really desperate cant find solution. {{ cl.queryset|dictsort:"button" }} button is a foreign key for this model, but some objects has no button relations. so dictsort doesnt work. what can i do?
Doragonsureiyā
Mahmood
Hi everyone I have a BaseImage class which is abstract class and have ImageField inside of it What i wanted to do is override the default method inside the ImageField from the inherited classes I didn't find anyway to do this
Mahmood
class BaseImage(models.Model): def upload_image_to(instance, filename): return get_upload_to_path(instance, filename) def default_image(): pass value = models.ImageField( upload_to=upload_image_to, default=default_image, verbose_name=_("Image"), blank=True, null=True, )
Irshod
What are you talking about?
I have for tabs in my template. each tab has its own title and body and when clicked on title only that tabs body should be displayed. I created a class to add content from admin panel so how to show it on template? https://pastebin.com/5xF4eZ29 this html part
Tура
Hi, I use allauth Django to send mail verification, but there is delay on live version, locally everything is fine
Tура
Some domains like @outlook.nl and @outlook.be, are not receiving at all
Tура
Could you give suggestions please
Erick
Hi guys, so I have a django implementation and I need to implement charts.js in this project, so my user is AbstractUser, where I made the differentiation through groups, now to implement the charts.js I need to get the users of their certain group and list them. Could someone point me to a documentation or something that can help me? I thank you for this. And sorry for my English, I'm using Google translator.
Daniel
hello. how to make html tabs dynamically using django?
Write JavaScript in the HTML template to open new tab. Use jinja for conditional checking and open tab
JavaScript
hello. how to make html tabs dynamically using django?
Ofc inside django template write JavaScript
Daniel
Works!
cj
Works!
but there's no need to add an extra dependency when you already have everything you need in the framework ¯\_(ツ)_/¯
0x
gus .how to format the datetimefield time to yyy-mm-dd h:m:s in django model 
Nidhi
Hi, Can anyone help me debug Django code ?
Nidhi
I am facing errors in my project.
Ibrahim
@pytest.fixture @pytest.mark.django_db def auth_client(): def get_auth_user(cur_user=None): client = APIClient() user= Extended_User.objects.all()[0] if cur_user is None else cur_user ...... error : RuntimeError: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it. ? any help ?
.
gus .how to format the datetimefield time to yyy-mm-dd h:m:s in django model 
The contents of that field is always a datetime.datetime instance. Where do you need the format to be displayed like that? If it’s in your html template, use the date filter https://docs.djangoproject.com/en/4.1/ref/templates/builtins/#date
Yooo
Anyone have durgasoft django course videos?
Maxim
Anyone have durgasoft django course videos?
this is not a video sharing group
MAHDI™
Hi, i want to make login and register in same page Anyone have repository so i can use it?!
Ras
Hi guy. I have these three models (I've summarize them): class Tourist(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) class Etablissement(models.Model): name = models.CharField(max_length=30) class Arrival(models.Model): tourist = models.ForeignKey(Tourist, on_delete=models.CASCADE) place = models.ForeignKey(Etablissement, on_delete=models.CASCADE) I want, for a Tourist, to have all his arrivals, per year. I've tried this: def detailTourist(request, id): touriste = Tourist.objects.get(id=id) datas = Arrival.objects.annotate(year=TruncYear('arrival_date')).values('year').annotate(total=Arrival.objects.filter(tourist=touriste)).order_by() but it give me an error: sub-select returns 19 columns - expected 1 (the arrival model has 19 field so i guest that's why it says 19. So finnaly, how can I do it please ?
.
Hello guys I was watching dinnes 7 hours django course and in the search part we couldn't see all rooms until we put icontains in the Room objects.filter() Can anyone explain why? And in order to search we put question mark followed by 'q' In the url Like this <a href="{% url 'home' %}?q{{topic. name}} " > Why did we do this and can i change the letter? I want to learn Django in its details so please give best source for this And forgive me for my bad English, thank you
Mike
Good evening all, Can you please help me in understanding decimal widget i want the data to have preceeding with 2 zeros while export
Mike
Is it possible to give decimal places in decimal widget
Ray_Beast
Hi anyone knows how from current server to another we can create log files.
Ray_Beast
Or any reference
Mike
Decimal widget or DecimalField
I used decimal widget it works in exporting the data shows right in txt format but when opening in csv the decimal values are displayed in integer format
.
Q is for querying When you make a get request, and you want to query some key value value pairs from html to your views.py
q = request.GET.get('q') if request.GET.get('q') != None else '' " rooms = Room.objects.filter(topicnameicontains=q) This is what I mean
Georg
Hello. Since I added a field BinaryFIeld into my model I can't delete records from it anymore.. if I run delete I get this: TypeError: cannot pickle 'memoryview' object
T-Br
Hell everyone. I am a new to Django and i am going to start studying? what do you recommend me?
Ndubuisi
Hell everyone. I am a new to Django and i am going to start studying? what do you recommend me?
First learn the basics of: 1) How the internet works behind the scenes 2) How Django works itself ( folders, routing..views... models) 3) How data flows
Erick
Hi guys, so I have a django implementation and I need to implement charts.js in this project, so my user is AbstractUser, where I made the differentiation through groups, now to implement the charts.js I need to get the users of their certain group and list them. Could someone point me to a documentation or something that can help me? I thank you for this. And sorry for my English, I'm using Google translator.
anrays
Hello guys i need solver django channels and redis problem.,?
👑 Dharmzeey
No
Okay That variable q (in views.py ) will hold the value for the key q that is sent from the browser (the html) which the keyword is sent as a get request. Then rooms will hold the value for the returned queryset you get from filtering the Room object. The filter function returns queryset of any room object that has the value q in it Example Say for instance <a href="{% url 'home' %}?q={{topic. name}} " > the first part is normal URL that you configured the second part after? Is the variable topic.name which the q will hold the value. Then the q is the accessed in the views.py. So for views.py if the value of q that is sent from the html is "computer memory" then in the views.py when you accessed the q the value will also be "computer memory" And when you perform the filter function, the Room will return the object the contains "computer memory" as a topic name. But icontains flag looks up any object which has the keyword in it either partially or fully If the q="computer" and in your models the topic is "computer memory" , the object will get returned because it contains computer in it ("computer memory") Look up django docs for more and well explained info
Enock
Does anyone know how to show ads on django?
Yah I do.. I have some running on my site.. enkuya1.pythonanywhere.com I can help on that
My
I have a problem with statci files. They raise 404 error what i shoul do
İremsultan
Hello, I have a html template i want to code in django. For now i need to take the header and footer parts and make images, css and js into static files. I tried to do it but it does not quite work, can anyone help me with it? I would greatly appreciate if someone can fix my mistakes and send me the file
My
thank u i found whitenoise