George
How do you do email or username login in django? I guess you first fetch the email that a username corresponds to and then login with that. Right? I guess you have to put the logic on what do to on login somewhere.
cj
How do you do email or username login in django? I guess you first fetch the email that a username corresponds to and then login with that. Right? I guess you have to put the logic on what do to on login somewhere.
first you have to make sure that email field is set to unique (by default it isn't) then just simply write a custom function to whether check for email or username on the User's model, the rest is a piece of cake
cj
you also need to add in settings.
he doesn't need to do anything in settings
George
Im not the most knowledgeable in Django but i smell bullshit from miles
iC0nst
Hi I've encountered the following trouble: my app doesn't see static files Where should static folder be located?
Kushal
From here anyone who worked in billing application
Vishal
Hi I've encountered the following trouble: my app doesn't see static files Where should static folder be located?
For static files in django you need to create a folder "static" inside project And in settings file you have to mention the path of folder And then run a command in terminal python manage.py collectstatic And {% load static %} should be in your html file Here is refrence you may get help https://docs.djangoproject.com/en/3.0/howto/static-files/
iC0nst
Thanks
Vishal
From here anyone who worked in billing application
What the problem you are facing please explain
iC0nst
But one this is still unclear Must static files of admin page be stored together with other static files
cj
you don't have to care about that, let the webserver manage how to serve static files, neither you nor django itself have to think about static files on production stage
iC0nst
In folder 'static/admin', yes?
Nitikesh
Please, provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you. Include details such as libraries, platforms, modules, etc.
As given in django docs We have 2 models Blog and Entry where entry field in Entry model contains foreign key to the Blog model. I have problem in updating the foreign key field and trouble in understanding how this updation exactly works
David
Hi guys. Does anyone know if how to apply celery in a recursive function to make it a task and generate a queue? The reason for this is that my recursive function is called too many times, since it consumes too much memory on the stack I need to fix this.
Anonymous
In folder 'static/admin', yes?
It'll automatically load in the path STATIC_ROOT set in settings.py file when you run collectstatic
Anonymous
foo = eval(i[1]) foo.objects...blablablab
Yes it work Thanks What ❓ actually eval do?
Anonymous
how to receive name value using request.POST method??
cj
try with eval
never, never use eval
David
recursivity is bad in general but you could limit it by carrying a variable or similar idk
Actually yes, but I don't know how to convert that function into an iterative function. Thanks for your advice, do more research on that.
Nitikesh
what you're trying to update and what problem you're facing?
Trying to update field containing foreign key but unable to understand logic behind it
George
can someone enlighten me on separating my website in apps? I got like 4 possible divisions of my database but im afraid to fuckup if i separate them in apps I got like: Users db UsersBussiness db A job database that gets data from UsersBussiness And a helper model that isn't dependent on any of them but will get data from the results of the job. Does it make sense to separate in apps? How would you do it? My models file is like 400 lines+ hmmmm
Anonymous
Trying to update field containing foreign key but unable to understand logic behind it
Are you trying to update the table structure or updating the records which linked to foreign fields?
Muflone
mmmmmmmmmm
apart this, you must not have a big models file, you can split models in a file per model
Muflone
apps are meant to reuse the code in another project
George
Why?
It's dangerous
Anonymous
It's dangerous
What problem occur if I used it
George
apart this, you must not have a big models file, you can split models in a file per model
Well, a file per model is a bit excessive but just abstractly related bits are good enough
Muflone
Well, a file per model is a bit excessive but just abstractly related bits are good enough
use what you prefer, the meaning is you are not forced to use a single file for everything
George
What problem occur if I used it
You could lead to ACE and that's the worse thing you could do.
George
use what you prefer, the meaning is you are not forced to use a single file for everything
Then the optimal thing in my case would be split the models file but just one app right?
Muflone
Then the optimal thing in my case would be split the models file but just one app right?
I don't know your project. if some models are conceptually indipendent (and reusable) from the other parts of the code, you might want to split in different apps
Muflone
I usually split my things in 3/4 apps and I prefer to keep a file per each model
George
Then making 4 databases wouldn't be that dumb right?
cj
Then making 4 databases wouldn't be that dumb right?
are you using that much databases for a single project? 😮
George
are you using that much databases for a single project? 😮
Well, i don't know how to structure my project
George
Is is then feasible to use 4 apps and 1 database?
cj
Well, i don't know how to structure my project
why not just 1 database and many tables? 🤔 what is your project about?
George
ACE? , means
Arbitrary code execution
cj
Is is then feasible to use 4 apps and 1 database?
you can have as many apps —which can have many models (which means you can have many tables)— as you want, and just use one database to store everything
George
Then i need to do that :D
George
That's nuclear nucelar
Muflone
Then making 4 databases wouldn't be that dumb right?
different databases cannot interact between them it won't be dump until the models keps in them don't need to interact or join between other databases
George
I don't really need 4 databases
Muflone
you cannot reference a model in FK kept in an another db from the PK, for example
George
I was just asking
George
Then 1 database
Muflone
yep
George
Then, i will search for references and if you got a good resource i will check :)
George
about models, apps or multiple databases?
Splitting in apps but a good reference
Muflone
I don't know, I use simple logic my project has apps for hotels, for the services done in them , for locations (city, countries), for utility stuff
Muflone
utility could be used whenever I need it locations can be used elsewhere hotels and work are pretty tighted between them, but hotels has rooms, structures, buildings and phisical things for a hotel, while work refers to the employees, to their levels, salaries, etc
Fabian
Hi, where can i find Django remote freelance job?
Doragonsureiyā
Hi, where can i find Django remote freelance job?
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 firsts results