Yusuf
help me sort out the issue with this code
.
help me sort out the issue with this code
What’s the issue with that code?
.
Now mapping is of 2 types app url and project url .. what's the key difference?
Project url: top level App url: second level url = project_url/app_url
Yusuf
What’s the issue with that code?
Could not parse the remainder: '=="0"' from '=="0"'
Yusuf
thats the error i get
morty
import this ones from django.conf.url.static import static from django.conf import setting
about code what if I import setting from the basedir of my project folders instead of Django.conf ?
Ali
I didn't try before
Ali
But write like that in documentation of django
DeViL
Plz provide complete roadmap of django
DeViL
There are many
DeViL
What to learn and how to start
DeViL
Plz anyone help
Doragonsureiyā
Plz provide complete roadmap of django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Adorilson
{% if vacancy.frontend =="0" and vacancy.backend =="0" and vacancy.fullstack =="0" and vacancy.Intern == "0" %}
Considering that vacancy is a Vacancy model, putting this logic in a property. In the template, Just: {% If vacancy.your_property %}
Diman
hello to everyone who will tell you, there is https zhang how to pick up metrics for prometheus
Seruios
hello, is it possible to create action in django admin inside each one row of table, not in all table?
Seruios
like instead of button Save, when editing one of rows
talha
in order to register external users (using web interface that makes post request) to website should I create a different user model or should I extend django user model? if I create my own model what are the cons of it?
Jamie
In django template I have to show only 10 data The data will show if condition is true The data is in nested
Jamie
How to achieve this
Jamie
Any suggestions How to show only 10 data
Abhie
I'm building data visualisation dashboard using drf I'm getting data from database, and will use chart.js for graphs, I'm not able to integrate my own frontend page where I was supposed to use chart.js
Abhie
Can someone help me
Abhie
I can filter and do all struff but getting all output on restframework built in page
Jamie
{% for user in users %} {% if user.x == True%} show X {% endif %} {% if user.y == True%} show Y    {% endif %} {% if user.z== True%} show Z    {% endif %} {% endfor %} It will show the number of lines when condition will true But I want to show only 10 lines
Jamie
Any suggestions how can I show only 5 lines
Caleb
Any suggestions dear Caleb
I don't understand your question either
Caleb
Any suggestions dear Caleb
Do you want to cut the items that are rendered to a specific number?
Jamie
Do you want to cut the items that are rendered to a specific number?
Yeah i want to cut the items and 10 times i want to show in UI Like Show X Show Z Show X ...10 times
Jamie
Show X Show Z Show X Show Y Show Y Show X Show Z Show X Show Z Show Y Like that I want to show only 10 times and rest of should be cut out
Caleb
Yeah i want to cut the items and 10 times i want to show in UI Like Show X Show Z Show X ...10 times
slicer="{}:{}".format(i,i+9) Then {% for user in users|slice:"{{slicer}}" %} Try this
Jamie
Okay
.
hello, is it possible to create action in django admin inside each one row of table, not in all table?
Yes, I have done that before. Search about “overriding admin’s submit_line template”
talha
The cons of creating a separate model is having 2 places that handle users. Better to centralize it.
so should I seperate users as group, and register external users like this?
.
so should I seperate users as group, and register external users like this?
Why not just have a single boolean field named “is_external” to mark whether the user is external or not, while maintaining the rest as is
Алексей
how to make a selection by field franchise for game in admin? def get_form(self, request, obj=None, **kwargs): form.base_fields['game'].queryset = Game.objects.filter(franchiseId=???????) return form
Jamie
Use the slice template filter https://stackoverflow.com/a/3907661
By using slice on loop the loop will run that number of times I want to count what inside loop The condition should not call If 10 times we will got the condition is true Like that 10 data will show for 10 conditions if they are true
Husan
hello , I need some guidance in my final year project ,if anyone have knowledge of websockets and channels in django . please feel free to dm me 😊,That would be a great help .
Алексей
filter(franchise__pk=franchise.pk)
how get id/pk from franchise in modelAdmin?
.
how get id/pk from franchise in modelAdmin?
100% depends on how you defined your models and its relationships, I’m just throwing guesses based on such small information you gave. I assume you want to populate the choices of a game based on the franchise assigned to a model instance. And assuming created instances should have a valid franchise instance, in that method, check if obj exists, if True, assign franchise = obj.franchise and proceed with filter.
.
I want to count if condition will true
Count = number If true = boolean Which results do you want?
Алексей
100% depends on how you defined your models and its relationships, I’m just throwing guesses based on such small information you gave. I assume you want to populate the choices of a game based on the franchise assigned to a model instance. And assuming created instances should have a valid franchise instance, in that method, check if obj exists, if True, assign franchise = obj.franchise and proceed with filter.
not help class IIAdmin(admin.ModelAdmin): list_display = ['franchise', 'game'] def get_form(self, request, obj=None, **kwargs): form.base_fields['game'].queryset = Game.objects.filter(franchiseId=????5????) return form how to dynamically show games that are based only on a franchise in admin? Class: franchise = models.ForeignKey(Franchise, related_name='inspirer', on_delete=models.SET_NULL, null=True,unique=True) game = models.ForeignKey(Game, related_name='inspirer', on_delete=models.SET_NULL, null=True, blank=True)
.
Like this
You should really do that kind of process in your views function in Python directly. You can use a while loop and include a counter in each if condition.
Алексей
Thanks for helping. If you want to dynamically populate the choice without refreshing the page, you’ll need to use JavaScript and AJAX to manipulate the element based on user interaction.
is there any way to filter the values of the game field by the franchise field? I'm not going to look for all the games in the list...
Алексей
is there any way to filter the values of the game field by the franchise field? I'm not going to look for all the games in the list...
I want to choose a franchise, and already based on the franchise to find these available games
.
is there any way to filter the values of the game field by the franchise field? I'm not going to look for all the games in the list...
Yes, like I said, using JavaScript and AJAX. An alternative would be to separate your create and update forms. And then, firstly in the create form, exclude the game field and require franchise field. Secondly in the update form, implement the game filtering based on existing franchise of the created instance.
.
Any reference
results = [] x = 0 while x < 10 if condition True: results.append(result) x+=1 repeat for other conditions And then pass results to context, and display them in template.
Soumalya
I have deployed my django project on render. In my model there some image fields they are not rendering properly. Those are only rending for few seconds after adding it from admin panel. But in the local host it is rendering properly. How it should be solved??
.
I have deployed my django project on render. In my model there some image fields they are not rendering properly. Those are only rending for few seconds after adding it from admin panel. But in the local host it is rendering properly. How it should be solved??
Did you use render disks? https://render.com/docs/disks If you’re uploading media to the filesystem, this might need to be handled differently because render’s filesystem is ephemeral.
Soumalya
.
No I haven't
Use it. You can verify if this is really the issue by checking 1. When you upload the image in admin, where is the file actually stored? 2. After that few seconds, check if that file automatically disappears Anyhow you should try to use that and see if it solves your issue. Your description seems to point that that is the solution.
ZeroCool
Hi, what is the best library for make PDF report in django?