Mirco
usually you define a "skeleton" into base.html to reuse and include pieces of html using blocks into base
Shreehari
Shreehari
Mirco
Ihor 🐈
Hi there, I have a question:
what kind of UML-relationship ussually have 'Article' and 'Tag'?
Is it assoсiation? Or aggregation? Implaying model "Article" has M2M field to Tag.
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
Has anyone seen this chrome input "option" bug and know how to tackle it? :
https://youtu.be/vZ13DXaYfRQ
Mirco
Anders (izzno / gooood) 🇳🇴
It was my gtk theme...
Anders (izzno / gooood) 🇳🇴
I've set chrome to use it...
senpos
Hi,
Can you share examples of your open-source DRF projects?
I am interested in a way you're using routers.
I have several apps in my projects. Each app has its own router (as I've seen in many tutorials and guides - it looks similar to this)
But how do I gather all the routers from each app? How do use them in my main urls.py?
Do I just extend my urlpatterns list with values from each app? But in this case I won't have a root router, which will help to browse my API endpoints easily. :(
At the moment here is what I've got. But it feels a bit off.
senpos
I guess, I'll just use a single router, import viewsets I need from each app and register them in one place
Yes, it breaks the idea of apps, but 🤷♀️
Ihor 🐈
Manish
Aadhi
Hello Guys,
Does anyone knows why I am getting following error
List object has no attribute 'items'
Muflone
Jatin
hello guys i need to check first character of string inside if statement in template. i write
{%if {{product.other_link|make_list|first}}=='T'%}
but i got error
"could not parse some characters:
|{{product.other_link|make_link|first}}=='T'
Mirco
Jatin
yeah I thought why pass additional dictionary field if i can do that in template. so, it is possible to check that if statement?
Jatin
it's take three keyboard argument in dictionary because i have to check three if statement.so, it's best if it's done on template.
Mirco
Jatin
Mirco
Jatin
Jatin
i didn't know that. i thought bigger the view ,bigger loading time😅😅
Mirco
Mirco
Jatin
Xyz
I always find myself googling the difference between auto_now and auto_now_add, lol
Xyz
Has anyone tried integrating Django with scrapy 🤔
Anonymous
any body who has computer science question bank bible this book
cj
mark
mark
or is it
Anonymous
Hi friends! need help. i have large QuerySet with Model field
date = models.DateTimeField(blank=True, null=True)
i am using DRF and serializers.SerializerMethodField(),
i want to make short Statistic with custom field, where numbers is month representatinon
"statistic" : {
"2016" : [ {1 : 200}, {2 : 400}, ........ {12 : 700}],
"2017" : [ {1 : 200}, {2 : 400}, ........ {12 : 700}],
}
can some one help
this is my sollution:
def last_day_of_month(self, any_day):
next_month = any_day.replace(day=28) + datetime.timedelta(days=4) # this will never fail
return next_month - datetime.timedelta(days=next_month.day)
def get_messages_years(self, obj):
qs = obj.envelopemodel_set
years = qs.dates("date", "year").distinct()
data = dict()
for y in years:
month_ = dict()
for month in range(1, 13):
count = qs.filter(
date__range=(datetime.datetime(y.year, month, 1, tzinfo=timezone.utc),
self.last_day_of_month(
datetime.datetime(y.year, month, 1, tzinfo=timezone.utc)))).count()
month_[month] = count
data[y.year] = month_
return data
Héctor
Hi friends! need help. i have large QuerySet with Model field
date = models.DateTimeField(blank=True, null=True)
i am using DRF and serializers.SerializerMethodField(),
i want to make short Statistic with custom field, where numbers is month representatinon
"statistic" : {
"2016" : [ {1 : 200}, {2 : 400}, ........ {12 : 700}],
"2017" : [ {1 : 200}, {2 : 400}, ........ {12 : 700}],
}
can some one help
this is my sollution:
def last_day_of_month(self, any_day):
next_month = any_day.replace(day=28) + datetime.timedelta(days=4) # this will never fail
return next_month - datetime.timedelta(days=next_month.day)
def get_messages_years(self, obj):
qs = obj.envelopemodel_set
years = qs.dates("date", "year").distinct()
data = dict()
for y in years:
month_ = dict()
for month in range(1, 13):
count = qs.filter(
date__range=(datetime.datetime(y.year, month, 1, tzinfo=timezone.utc),
self.last_day_of_month(
datetime.datetime(y.year, month, 1, tzinfo=timezone.utc)))).count()
month_[month] = count
data[y.year] = month_
return data
https://www.django-rest-framework.org/api-guide/fields/#serializermethodfield
Livan
hi all, how used grphql with django?
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Hi here
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
I want to pass a form and the result of a request to the template of this kind when displaying, I get a form with the values from the result of the query. Exactly like when you modify a tuple via the admin page of django. How to do it ? Views.py
def modification_ue(request, code):
ue_form = UEForms()
ue = UE.objects.get(code_ue=code)
return render(request, 'felyn/modifier.html', {'ue_form': ue_form, 'ue': ue})
Doragonsureiyā
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
def modification_ue(request, code):
ue_form = UEForms()
ue = UE.objects.get(code_ue=code)
return render(request, 'felyn/modifier.html', {'ue_form': ue_form, 'ue': ue})
Doragonsureiyā
st9_8
Mirco
Why not ?
Anders (izzno / gooood) 🇳🇴
Why not ?
Theres no advanteges to choose django if ONLY using mongo.
Mirco
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
I assumed.
Anders (izzno / gooood) 🇳🇴
made an "ass" out of "u" and "me"
Mirco
Xyz
Webfaction dealt with me though, need to consider using another platform for hosting Django apps
Anonymous
Github: Python3
https://github.com/8140171224
REDDY
Hi... All my friends I need Django book's friends anyone send me... Plz
Anonymous
https://www.pdfdrive.com/mastering-django-core-e27131081.html
Bharat
I start learning django which platform is good udemy, youtube or other
Anonymous
Get a book
Anonymous
The best kind of resource
Doragonsureiyā
Le Createur
Thanks
S.
Hi all. my inlinefactory_formset save only 1 data when extras=1
if extras=; 3 save 3 data
additinional info: https://stackoverflow.com/questions/56099415/inlineformset-factory-save-data-much-as-extras
can you help me please :/
Anonymous
Hi guys! I having an issue when run project in Pycharm software.
Error is shown as below,👇
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
Could anyone please help me how to solve this issue and run my project?
Mirco
Mirco
So you can let pycharm knows where to look for your venv's site-packages
Anonymous
Is it mean to use command venv\Scripts\activate in terminal?
Mirco
Anonymous
Mirco
Follow the link of Pycharm docs 😁
Anonymous
Hi
Shreehari
Okay. Let me check it
Suggestion: use some linux based distros & you can create a virtualenv & working with projects in linux based distros is easier