hi everyoned, i started to learn Django 6month ago and i have a problem
When i add a or more fields to class, i can’t save it
My solution is to delete the previous archives but it take more time to save db agian
I hope to receive at least one answer
thank you!
We’re going to need a lot more detail here to even try and help you answer your question.
This includes showing what changes you’ve made to your models, and what other changes you made to your project.
After making your changes to your model class, what did you do after that?
When you say “I can’t save it”, what exactly is happening? Are you getting an error message? Is something else happening?
For some ideas as to the type of information to provide see How do I ask a good question? - Help Center - Stack Overflow
after i add new field and if i don’t set “null=true” , i can’t save it
is “null=true” important? what will happen in the future if “null=true”?
Ok, so the makemigrations
is telling you that you either need to add null=True
or you can supply a default value.
The Model docs for Field options describe what the null option is. It’s up to you to decide whether or not you need to allow nulls in that column, and that’s a data-design issue and not a Django issue. Django will let you design your table either way.
If you’re not familiar with the concept of nulls in a database, I suggest you find some resources to learn about them - they’re a standard feature of relational database systems. (Sorry, I don’t have any specific resources to share.)
(Side note: In the future, please do not post images of code here in the forum. Copy/paste the code and error messages into the post, fenced between lines consisting of three backtick - ` characters. This means you’d have one line of ```, then your code, then another line of ```. Images can’t be read on all devices, text within them can’t be searched, and individual lines can’t be quoted when answering questions.)
thank for your suggestion
and now i want to learn Reactjs .Can you tell me some docs about React and ytb channel about it?
I’m sorry, I don’t use React and am not familiar with any of the resources available for it. Maybe someone else who is browsing this thread can jump in with some recommendations.
I would start with the standard docs and tutorial for React. If you’re coming in entirely new, you should probably start there. If you’re unfamiliar with JavaScript the tutorial recommends going through the MDN’s JavaScript re-introduction first.
I don’t have a youtube channel to recommend unfortunately.
can you tell me about cached in django?I search and find the website: dataflair. At here, there is more than one way to set-up cached but i don’t have enough knowledge to understand how way true…and my question is: is Cached neccessary?if true, how way to set-up it effective?
Like every other optimization question: Build your site first, at least enough of it to see where the problems may be. Then test and benchmark to find where the real bottlenecks are. Once you’ve identified what the slowest part of your system is, then you can figure out what to do about it.
thank guy
so…cached cookie section can do after build site
is right?
I’m not sure what you’re asking here. Can you be more specific about what you’re looking to determine?
(Did you actually mean cashed cookie sessions? If so, then yes. I’d make that something I’d look at after you have enough of a site running to determine that not using it is causing an issue.)
i’m a newbie …so i can’t know the best learning route
can you suggest me about it?
Again, can you please be more specific with your questions? What is it that you need more information with?
i don’t know which part to learn first in Django
Oh, ok. From your original question I figured you had been working with Django for a bit.
I always recommend someone get started with either (or both) of the official Django tutorial or Django Girls tutorial. (Not just read them, but actually working through them - including typing all the code and examples and not just copy/paste.)
They’re both very good and are going to give you a good foundation.