Dullah
{{ score.team.<field name of team name> }}
Error: couldn’t parse the remainder: < teamname> from score.team
Alex
Error: couldn’t parse the remainder: < teamname> from score.team
make sure you don't encapsulate variable with {{}} in if condition
Dullah
make sure you don't encapsulate variable with {{}} in if condition
This is the Actual code. {% for scoreboard in object_list %} {{ scoreboard.team }} {% endfor %} #this outputs the team name “Liverpool” #i want to set an image for the name “Liverpool” I tried {% if scoreboard.team.< Liverpool > %} <img src={% static “path” %} {% endif %} #this results to the above error
Aashish
In development my api is working but after deployment i can noy post data from react to django deployed oh heroku.....any idea
Alex
share codebase
Dullah
error?
No error no nothing.
Dullah
It’s like it returns a False value
Dullah
share codebase
Which part specifically, to just narrow it down
Dullah
Models.py
Dullah
class Scoreboard(models.Model): competition = models.CharField(max_length=20) date = models.DateField(auto_now_add=True) time = models.TimeField(auto_now_add=True) player = models.ForeignKey(User, on_delete=models.CASCADE, related_name='player1') league = models.ForeignKey(League, on_delete=models.CASCADE, related_name='player1') team = models.ForeignKey(Team, on_delete=models.CASCADE, related_name='player1') score = models.IntegerField(default=0)
Dullah
template👇🏾
Dullah
<div class="container"> <div class="card"> <div class="card-body"> {% for scoreboard in object_list %} <h5> {{ scoreboard.team }} Vs {{ scoreboard.player }} </h5> {% if scoreboard.team == "Liverpool" %} <h3>Liverpool Are The Champions</h3> <img src="{% static 'images/liverpool.jpg' %}" alt="crest"> {% endif %} {% endfor %} </div> </div> </div>
Dullah
View.py
Dullah
class ScoreboardListView(generic.ListView): model = Scoreboard template_name = "score/scoreboard-list.html" queryset = Scoreboard.objects.all()
Dullah
entire code.
Here it is
Alex
Here it is
Team Model?
Dullah
Class Team name = models.Charfield(max_length=20) League = models.Fk(League, on_delete=models.CASCADE)
Alex
'.name' is missing in code?
Dullah
{% if scoreboard.team.name == "Liverpool" %}
I really appreciate the help, it did the job, thanks
Nasib
do I need to learn javascript especially ajax and jquery if I know bootstrap and django to create websites
Nasib
depend on if you want to work as full stack or not.
waht if I need to work as a fullstack
Nasib
waht if I need to work as a fullstack
what if I need to work as a fullstack
Nasib
javascript is must.
I searched on YouTube some guys say that bootstrap 5 has removed the use of jquery that you can use it by itself
Code
https://dpaste.org/rDSCO i will try django social auth using twitter with tweepy but it return The tokens are invalid or expired because api.verify_credentials(include_email=True) does not work
rtg
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
Rohan
Read 2 scoops of django.
Rohan
Very trivial problem and many ways to solve it
Груша
hello, can i return the html template to which the Node.js script will be attached to fetch the request and render the page?
Sayan
pls help
Sayan
whenever i try to start server in django
Sayan
this comes up
Sayan
im not getting any solution
Sayan
https://linkode.org/#eIkLzPWmd6UL069b3sZuM3
Sayan
heres the error
No one
Hello, my first project is ran in local server properly but when i deploy in heroku and I try to open occur a error=503 code=h10 . How can fix this error???
Nobin
Hello, my first project is ran in local server properly but when i deploy in heroku and I try to open occur a error=503 code=h10 . How can fix this error???
Sorry brother I never used heroku thats why i don't know what the cause. But definitely you made some mistakes... There is many tutorials on deploy in heroku. Search in YouTube and you maybfind a solution
Vikash
Also check what actual error because it's show when app crash..
Vikash
Yes
https://github.com/vikash98k/deploy_django_on_heroku
Rajeev
How to deploy channels project on aws?
Anton
Hello! Dose django translation works with F strings?
Dullah
Hello Guys, How can i combine a Detail View with a Create View?
Dullah
Apiview
Reference on how i can do that please
Brutus
i'm having two forms on different tabs in same page and i need to update context passed in view with post request but not able to solve it. can anyone help with that ??
Dullah
Apiview
Is there any other way rather than the API
Shokhzod Samariddinov
Hi! I am creating travel website so I intend to use drf for backend but i hesitate to use it becouse of poor perfomance.There may be 10000 request How ca you advice me about using drf or not
Anonymous
Hi! I am creating travel website so I intend to use drf for backend but i hesitate to use it becouse of poor perfomance.There may be 10000 request How ca you advice me about using drf or not
maybe this article is helpful :) https://medium.com/ebs-integrator/how-django-can-handle-100-millions-of-requests-per-day-c4cdbf48639e
Yusuf
Ok i will try
Eslam
guys how can create new app label in admin Because I want to make a group for some models in new label
Bruce
hey any django opensource contributer here ?
Bruce
Why?
any tips please
Bruce
because I want to contribute
Bruce
but all I am doing is just updating documentation
Bruce
just tell what can I do to code
Charly
just tell what can I do to code
Start to review the open PRs and then the open issues
LAPRIX
Hallo guys! I create project on book "Create websites on python Django" and i have error: Error: This command is not available when running the Angular CLI outside a workspace after command: ng generate project-list --flat How to resolve it problem?
Ted🇯🇲