EdisonMolina
save() missing 1 required positional argument: 'content'
Andrej
Do you want to save or load an xml file? You say import, but you import a package or a class. Xml files can be loaded. The xml library will be imported.
Andrey
Hello Guys! I think it is a bit strange task, but I need to sort objects by the presence of m2m relation between Advertisers and AgencyTenant models.
This code is as close as possible to what I want, but produces identical duplicates:
Advertisers.alias(tenant_ordering=Case(When(agency_tenants__id=tenant_id, then=Value(0)),
default=Value(1),
output_field=IntegerField())
).order_by('tenant_ordering', 'id').distinct()
This code works correctly, but I would like to avoid a subquery:
Advertiser.objects.annotate(
tenant_ordering=Exists(AgencyTenant.objects.filter(id=tenant_id, advertisers__id=OuterRef("pk")))
).order_by("-tenant_ordering", "id")
Does anyone know how to fix the first query? Thank you very much for your attention!
RIP
<i class="bi-plus opico" id='opico01' rownum=1 onclick="getrownum(this)"></i>
<script>
function getrownum(i){
var _rownum = i.attrbiutes['rownum'];
alert(rownum);
};
</script>
RIP
please, why i get error
RIP
Cannot read properties of undefined (reading 'rownum')
Georgiy
RIP
sure I make lots of mistake in syntax
RIP
It is run well now.
Ali
Hi
I'm creating a form from model and in meta class im showing some Fields
But in that model there is foreign key
How can I set that?
Kim
Set what?! Foreign key?!
Kim
I think you don't need to set the foreign key in form it's auto increments
Ali
Grace
I am developing a hospital system and there is this issue of billing when a patient books an appointment, How am i supposed to create invoices when a particular action occurs, is using the django signals the best approach?
Anandu
SMTPAuthenticationError at /accounts/register/
(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials n11-20020a170902e54b00b0015e8d4eb273sm3212822plf.189 - gsmtp')
Anandu
i got this error
Anandu
any one pls help
eugene
eugene
Eslam
hi guys how to add fake data in project
Anandu
Phansivang
Hello I want to make the user that allow only see there own post if they not owner that post so they will not see that post too ? how can I do it ?
Andrey
You need to create a relation between User and Post. After that just filter the response by the user who made the request. Or use something like django-guardian.
Sayan
Hello
I'm using class based views and have a input form for creating post
so when i pass in an image it doesnt get it and just refreshes.
text input works
Link to code in question: https://paste.kaizoku.cyou/dpb6X5gu
Roberto
How to simply activate any command from my terminal using Django?
Rohan
Roberto
I would like a Guide Interface to activate my scripts.
Rohan
Roberto
Using Django instead of GTK or QT5. 😜
Rohan
Please use offtopic for this.
cj
Using Django instead of GTK or QT5. 😜
you're messing things in a biiiiiiiiiiiiiig and baaaaaaaaaaad way
it's not gonna work the way you suppose/think/expect it to work
¯\_(ツ)_/¯
Rohan
cj
Bazaroph
Hi guys, I'm looking for a way to replace the username by email in the rest_framework_simplejwt
Bazaroph
Ugochukwu
Guys I did my first Django project today, help me check it out
Artyom
Ugochukwu
Ugochukwu
Congrats!
Can I send you the Github repo?
Artyom
Publish it here
Ugochukwu
I tried to but the admin bot deleted it
Artyom
Oh
Artyom
praveen kumar
Any1 had free course of django with ajax
Doragonsureiyā
Any1 had free course of django with ajax
These single steps will help you a lot:
Step 1️⃣: Open a browser
Step 2️⃣: Write down https://google.com or https://duck.com and press Enter
Step 3️⃣: In the search box, write down the same words you asked here
Step 4️⃣: Read the first results
Thayrone
Hello guys, someone know how can i manipulate select2 in JS created by Django
Elena 🇺🇦❤️
Hey
When I try to run the tests I get this error
Someone faced? Please tell me how to solve this
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Process finished with exit code 1
Empty suite
Bazaroph
Bazaroph
but users used for the text exist
Doragonsureiyā
Elena 🇺🇦❤️
Just do as it says
But I don’t understand, where accessing settings
Can you help me? 😅
Elena 🇺🇦❤️
I have this piece of code in manage.py
Никита
Hello People. I use Django channel and have small problem. i want only people visible for message.
Никита
Subscribe not correct work
Никита
https://prnt.sc/wXUd8EEiUqdk - model_observer
https://prnt.sc/aXTGlbUJG5lS - model
https://prnt.sc/iWw0ctWQaCY6 - subscribe
user visible not only for him message
Ivan
Hi, for PDF's ... reportlab is good? or someone knows some alternative
No_name
I am not able to save data from form to model in django
No_name
Can somebody help
Bazaroph
Do yourform.save() if you your form is related to a model
Victor
Ivan
Vikash
😷🇨🇺 Gustavo Valmaña Villalonga
hello my friends
😷🇨🇺 Gustavo Valmaña Villalonga
I need help with virtual enviorements and enviorements vars, how can I set var for virtual enviorements without using .env files? I mean, is possible to set the env variables without use export VAR=VALUE ?
Charly
😷🇨🇺 Gustavo Valmaña Villalonga
Doragonsureiyā
yes I know is about SO
Your question is not related to Django.
If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Bazaroph
I would like to use email authentication instead of username authentication.
here is my code
serializer.py
class EmailTokenObtainPairSerializer(TokenObtainPairSerializer):
username_field = get_user_model().EMAIL_FIELD
views.py
class EmailTokenObtainPairView(TokenObtainPairView):
serializer_class = EmailTokenObtainPairSerializer
urls.py
path('api/token/', EmailTokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
Bazaroph
i get this error
"detail": "No active account found with the given credentials"
Bazaroph
can you help me ?
Felipe
Hi, I have one question, is possible used the method GET and POST in more of one table of one database in django ?
Charly