vinoth
hi guys,
im new to django. i cannot save anydata at poll>urls file. if i enter anydata in urls file. i cannot close it. kindly help me guys
Mirco
Mirco
!paste
Doragonsureiyā
To share code or error tracebacks please use an online pasting service, here is a list of suggested sites:
- https://del.dog
- https://dpaste.org
- https://linkode.org
- https://hastebin.com
- https://bin.kv2.dev
Rangarajan
vinoth
https://del.dog/ulirranull
Rangarajan
Always try to install python from python.org
garrip91
Rangarajan
garrip91 did you set the variable PATH?
garrip91
garrip91
Rangarajan
Can you send the error message?
PP
Hello everyone,
I have one question how I get out of the loop after clicking stop button if loop is running already
Please help me
Anonymous
Anonymous
Hi, I am using django-background-task for scheduled jobs. In mysql background-task table, duplicate task names are coming..did any one face this type of issue ? How did you sort this issue ?
Anonymous
Guys can you pls tell me the best resource to learn django
cj
Anonymous
Diffrwnce between Model inheritance vs Model Relationship?
Anonymous
Anyone ....worked on django viwset method overriding
Anonymous
Fuck
Anonymous
I forgot to see correct server error
Gk
Anyone working with crispy forms
sheikh
Mirco
Doragonsureiyā
Anyone working with crispy forms
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z"
Just ask about your problem directly! With ~80,000 people here, the probability that someone will help is pretty high.
How to ask smart questions: http://catb.org/~esr/faqs/smart-questions.html
Werner
ah nice
Oleg
Guys, could you please point this out.
Is it a correct way to write such business logic in django models.py (just get model class from instance)
def db_marked_as_dr(self):
return self.class.objects.filter(is_db_dr=True)
or should I just dont bother my head and to simply import model in views and to transfer filtered data like: data= Model.objects.filter(is_db_dr=True) in template through context?
Oleg
What's the correct way to handle such things? Where should I write business logic?
Oleg
I have such misunderstanding because of Django rules (Django recommend to write business logic in models.py and to not combine it with views.py) So should I take this advice and to strive to write such things in models.py?
Mirco
Try to keep views small
Oleg
Oke, got you. But how you recommend to handle that case I listed above? Is it a correct way to access model through its instance?
Oleg
Do I need to just simply write a method in model Database and to write a specific method in which I just simply use manager of Model and dont interacting with its instance (through self.class) So like: Database.ojbects.filter(....) instead of self.class.objects.filter(is_db_dr=True)
Mirco
Mirco
The only improvement you can do is that if it's a common query, use a Custom Manager or a custom queryset if you wanna chain it
Oleg
But query to db is a business logic, right? So at this case why should i write it in views.py?
Heigler Rocha
But query to db is a business logic, right? So at this case why should i write it in views.py?
I think you're trying to follow the layered pattern and looking to that query as a repository thing, right?
Django by default is MTV, that means its ok to make your queries in View, CBV itself has properties and methods like "get_queryset" and so on.
Use the model for operations that need a database instance like get_absolute_url, and if you want an abstraction for complex or common queries use CustomManagers instead.
Oleg
Mirco
Mirco
2 Scoops of Django is a suggested book to improve this kind of skills 😊
Oleg
Mirco
Doragonsureiyā
Oleg
Seems like, at this stage, I will look in the direction of custom managers :)
Anonymous
How to use filter functionality in template of django? Someone?
Anonymous
Instead of using that in .py file
Mirco
Anonymous
Hello friends,
I am using django built-in authentication, I have an app called "bonus" which has a "registration" as sub-folder, I have templates for password reset etc but the problem is that it always redirect me to the admin when I want to reset password.. can someone please help?
Anonymous
Try django-registration-redux
Sadra
Sadra
SIGNUP_REDIRECT
SIGNIN_REDIRECT
Sadra
Not quit sure. You better Google.
nightescapist
nightescapist
Check that urls. Py page
Anonymous
Anonymous
I use path('accounts/', include('django.contrib.auth.urls')
Duncan
Guys, I want to start learning ML.. I am starting from scratch and I need someone that can help me set up my laptop to start everything.. please..
nightescapist
Satish
hello, is there a way to use Django rest api on an already existing database?
Stephen
When designing a mult-tenant project (Saas), when do you implement it? Is it after you have designed the entire project and everything is working as expected or from the start?
Ismail
Duncan
have you any resources
No please I am starting from scratch, I know nothing at all. I don't even know how to set up my laptop and start writing in the language
Ismail
First of all download Anaconda distrbution
Duncan
Ismail
Choose a resource for learning ML
Notice that all resources just are a guide for you and just show you the correct way then your hardwork and consistence needed
Ismail
There is a lot of hard skills and soft skills that you need to learn through the way
but for start just find good book or course to teach you the basics....
Shivam
Hello Guys I just started learning django
I'm getting a error saying poll.urls don't have any patterns
I already checked the spelling of urlpatters...
Still getting this error
Ehsan
Ehsan
upload screenshot please
Shivam
Okay wait
Anonymous
I creat hello_world in django and in hello-world I creat an app(app1) and when I m done with all other coding and came to give the path of app1 to hello-world URL throw include(app1.URL)...
Its give an error that app1 is not defined
Ismail
Shivam
Sending Medi isn't allowed?