HamidReza Fekri
Anonymous
HamidReza Fekri
Anonymous
I have no [] in it
😂 Go check out the line the error is traced. It's very clear
HamidReza Fekri
HamidReza Fekri
this error line can you see any []
HamidReza Fekri
Anonymous
Then check the source code of that filter. It might be trying to index the argument you passed to it
Anonymous
Then interpreter is always right
HamidReza Fekri
Willian
Hi, I need help tô deploy django + apache + asgi
Willian
Could someone in the group help me?
Anonymous
Hello guys, please I need help on what to learn to become a full stack web developer using Django, am a self learn beginner programmer and I don't know what to learn, so far I only know basics of python and a little SQL server and also am doing some studies on Django and I know just a little about it, so guys please what should I know or what should I learn to become a full stack web developer 😔😞
HamidReza Fekri
hello is there any one work with tree foreign key (mptt) I got and error and i can't solve it
HamidReza Fekri
{% load mptt_tags %}
<ul class="root list-group">
{% recursetree category %}
<li style="list-style-type: none ;font-size:15px">
<a href="{% url 'category_detail' slug=node.slug %}"
style="list-style-type: none "
class="list-group-item bg-light">{{ node.name }}</a>
{% if not node.is_leaf_node %}
<ul class="children">
{{ children }}
</ul>
{% endif %}
</li>
{% endrecursetree %}
</ul>
HamidReza Fekri
the error is this👇👇👇👇👇
HamidReza Fekri
'Category' object is not subscriptable
HamidReza Fekri
when i add href
HamidReza Fekri
ok
HamidReza Fekri
from .models import *
def add_var_to_context(request):
category = Category.objects.all()
return {
'category': category,
}
HamidReza Fekri
HamidReza Fekri
class CategoryProductsView(DetailView):
template_name = 'product/category_detail.html'
model = Category
HamidReza Fekri
render to category_detail
HamidReza Fekri
where
𝙰𝚕𝚒 シ
Use hastebin.com to share the code
Harish
A model 'C' has its data given in the form of Fixtures. Many models are dependent on this model through both FK & M2M.
Now, in Develop, it has some pk for particular object, while in Prod, for that pk, some different object is set, causing Fixture inconsistency in pk's.
To resolve this, in (test db),
1. I tried to alter the schema of child table of C with "ON UPDATE CASCADE" in psql using this https://stackoverflow.com/questions/25973576/updating-primary-keys-in-postgresql., since Django doesn't have on_update=models.CASCADE.
3. I then updated the pk of 'C' objects with the one having in development, in order to avoid Unique constraint failed error, (at this moment, update reflected in Child model) & then reloaded the fixture, it was fine.
Some Side effect of this change resulted in "some_model_id_seq" got its value replaced with new one ( because of my Fixture pk change )
My queries are :
1. Is this way the correct to do ?, If so, it won't cause any serious issues ( because of changing pk )?
2. I tried in only one child of C, but there are many more children models of C. So, for them also, I should do manually or any other quick way ?
3. For Child model having M2M, I tried to same Operation in the "Join Table", since that has FK to Parent, it works as expected. Is that ok to do, or any other special change required for it?
4. Is there any other way to solve this ? I'm thinking of having env specific Fixtures ( for Prod, 1 fixture , for Dev, different fixture ). But, it's too much of thing to do..
Changing primary keys is definitely a bad idea, but I don't have any other choice to maintain consistency of 'C' across all env's..
Sorry for the wall of text, since I need to clearly explain what my problem is.
Maxim
A model 'C' has its data given in the form of Fixtures. Many models are dependent on this model through both FK & M2M.
Now, in Develop, it has some pk for particular object, while in Prod, for that pk, some different object is set, causing Fixture inconsistency in pk's.
To resolve this, in (test db),
1. I tried to alter the schema of child table of C with "ON UPDATE CASCADE" in psql using this https://stackoverflow.com/questions/25973576/updating-primary-keys-in-postgresql., since Django doesn't have on_update=models.CASCADE.
3. I then updated the pk of 'C' objects with the one having in development, in order to avoid Unique constraint failed error, (at this moment, update reflected in Child model) & then reloaded the fixture, it was fine.
Some Side effect of this change resulted in "some_model_id_seq" got its value replaced with new one ( because of my Fixture pk change )
My queries are :
1. Is this way the correct to do ?, If so, it won't cause any serious issues ( because of changing pk )?
2. I tried in only one child of C, but there are many more children models of C. So, for them also, I should do manually or any other quick way ?
3. For Child model having M2M, I tried to same Operation in the "Join Table", since that has FK to Parent, it works as expected. Is that ok to do, or any other special change required for it?
4. Is there any other way to solve this ? I'm thinking of having env specific Fixtures ( for Prod, 1 fixture , for Dev, different fixture ). But, it's too much of thing to do..
Changing primary keys is definitely a bad idea, but I don't have any other choice to maintain consistency of 'C' across all env's..
Sorry for the wall of text, since I need to clearly explain what my problem is.
here are the same rules as in @python
Yashar
How to customize ckeditor for Django? I want to add a liststyle. I write it in the extra_plugins in CKEDITOR_CONFIGS, but first, I don't know the correct name ("liststyle", "Liststyle", "listStyle" etc), but even after trying all of them it doesn't work. I need to have roman, and other stuff. I found this piece of code "editor.execute( 'listStyle', { type: 'decimal' } );" but I dunno where I would even put it.
.
How to create database dynamically in Django like if a user selects a particular checkbox in frontend based on that database is created and value is added.and that table keeps changing as soon as user selects different checkbox in frontend ,based on the dynamically create database I have to add the calculate value in the database and fetch from it and show it in frontend.How to achieve this please help,any resource or any insights that will help
.
???
ℕ𝕠𝕔
✋ I need a help whenever i was write 'phyton manage.py runserver' it say error what shall i do
_karimoff_1904
salom do'stlar hozirgi kunda eng ommabop va yaxshi serverlar qaysi sayt deploy qilmoqchi edim pullik tekin farqi yo'q
Bjorn
Sanji
Hi Guyz...Can Anyone Help me to deploy My Django website?
Anonymous
ℕ𝕠𝕔
What kind of error?
phyton : The term 'phyton' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + phyton manage.py runserver + ~~ + CategoryInfo : ObjectNotFound: (phyton:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
ℕ𝕠𝕔
Arslan
try python manage.py runserver, should work)
Anonymous
Anonymous
Yashar
omg...
ℕ𝕠𝕔
Still it was saying the same
ℕ𝕠𝕔
It was worked right now thanks all of you
Sanji
Dami_codr
Anonymous
Anonymous
Hello need dev for my project
khatri
Hii I'm rakesh
Please tell me how to my project add to user login and registration and logout
Anonymous
Any indian django dev is here ?
Anonymous
I need backend django support for my proejct
Shubham
Anonymous
khatri
Anonymous
Custom user role and permission send example
Mirco
Doragonsureiyā
Custom user role and permission send example
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
Anonymous
Mirco
Sanji
Dami_codr
Hosting
It's pretty easy. You just have to set up python app on the cpanel
Sanji
It's pretty easy. You just have to set up python app on the cpanel
I was trying using heroku and git and following some utube videos where, they did some changes like changing DEBUG to False, adding heroku to allowed Hosts and creating files like procfile and requirements.txt but I'm always ending with an error in the final page of my website
Sherlock
i have a small doubt i'm getting stuck for long in code view.py
def index(request):
webpages_list = AccessRecord.objects.order_by('date')
date_dict = {'access_records' : webpages_list}
return render(request, 'app/index.html', date_dict)
in above code i write
date_dict = {'access_records' : 'webpages_list'} with qoutes
i don't know where to use qoutes and where not to any general idea please suggest🙏🙏
J
If you're using a string put it in quote.
In your above code webpages_list is not a string, it's a variable holding some value so it should not be in quote.
access_records is a key name which is a string so it should be in quotes
Sherlock
Jay
How do i get user id (condition - user not logged in yet, but registered)
Jay
request.user.id is giving error
-request is not defined
Dami_codr
Anonymous
Testing
Anonymous
Hello hellow
Anonymous
This is only for college students
laurel
Hello bro, I stuck in my project, where I am creating API for college management system. I have a Teacher table that is OnetoOne related with User table. I want that any teacher and view and update any teacher details. For that I created a group of "teacher" in Group table and give permission for "can update teacher ". I add teacher to that group. But when I go to update teacher detail It says you don't have permission. It work when I give "can change User" person to teacher. I used JWT for authentication and DjangoModelPermisson as permission class
James
Hello can anyone tell how to calculate the average of each student and render it in template:
James
class Results(models.Model):
student = models.ForeignKey(Student, on_delete=models.RESTRICT)
entry = models.ForeignKey(Entry,on_delete=models.SET_NULL, null=True)
subject_name = models.CharField(max_length=20)
marks = models.FloatField()
remarks = models.CharField(max_length=255, null=True)
Sanji