Adding objects to users in Django - django

I am very new to Django and I am trying to build a web app that users can add the books they read and see other users that read the same book. How can I do this in Django? What functions should I add?

Related

One app in Django is enough for whole website?

I'm new to Django framework and currently working on an ecommerce website. Not sure what would be better, when creating new project and new app in Django, does a single app is enough and fine for whole website functionally(all HTML pages, user login/registration etc) or should I use separate apps in my project?
one app for one purpose.
don't describe your app with 'and'.
like: my_app_name' to manage students and exams.
just create 'students' app to manage students and 'exams' to manage exams
According to the great book on django 'Two scoops of django' we should create an app for only one purpose. If the work of an app is beyond a topic we should create another one.
So I think you should create separate apps for various tasks of your web-application like:
accounts : app for user model
products : app for product model
orders : app for managing orders
payments : app for the order payments
...
and many more.
As far I have used Django in my profession about four years, I think Django and python is comprehensive kit for building e-commerce web app.

Authy/Twilio OTP in Django without custom user model

I'm trying to learn how to use Authy/Twilio in a new Django app. I found this helpful demo application https://github.com/TwilioDevEd/account-security-quickstart-django which I was reading through to see how it all worked. I noticed in the settings.py file they referenced a custom user model, which I found here. The custom model looks very basic and doesn't have much of the info stored in the regular user model.
My questions are:
Is it required to use this custom model or can you somehow add the
required info into the existing/default user model?
How would this integrate with Django apps using something else (like
ldap) as the backend instead of the django db user model?

Django Forms without admin

I am learning Django, I saw so many videos of DJango.
I just wanted to know one thing that can we create an app (like login app, or contact app) without registering it into in admin (admin.py).
Off course it should have model etc to save the contact details or login details etc. Is it possible in Django ?
Just don't create your admin.py file or not register the model that you don't want to see there. Django admin is fully optional.

Django app structure, good practice?

I'm new to Django and am currently struggling with how to structure the apps.
The site is one with a public frontend, in which you can login to enter a dashboard. I've created a separate app for this dashboard.
Now I want to display a list of employees on one page of this dashboard, however I've created another app for these employees.
Should I create this new page/view, in the employees app? Or should I delete this employee app, and include that model in the dashboard app?
What is considered good practice?
It currently looks like this:
-site
-- dashboard app
-- employee app
Source: Two Scoops of Django: Best Practices for Django 1.8 p-35

create an admin's like application in django

Im really confused about what is all i need to consider for creating a django aplication with almost similar functionality to it's own admin.
The index page should deploy the list of models the user has access to modify or create...almost the same as when you put admin.site.register(MyModel) but with permission restriction. Im not sure how should i ckeck permissions, and show 1 ,2 or many "ModelAdmis" on my main page.
btw admin users are redirected to the admin index page, non-admins go to my page
Before you consider creating a django admin from scratch, you should read the answers to this question Django Admin app or roll my own?
I couldn't find any resource on how to create a django admin from scratch, but here's what you should do if this is your first time overriding a framework's functionality (in my humble opinion):
Understand and make sure you are comfortable with the django admin app
start from the docs https://docs.djangoproject.com/en/1.7/#the-admin
Head over to the django admin app source code so you can start reading the internals of the functionality you want to implement/override in your new admin app.
source code can be found here https://github.com/django/django/tree/master/django/contrib/admin
(this may involve reading other apps source code too)
After those two steps you should have an idea on how the admin app is implemented and it's dependencies, then you can start creating your custom admin app.
an example on how this may go can be found in this qestion:
How to override Django admin's views?
If you are building something new, try to separate the UI from the backend. You can build your UI using react, angular or whatever and interact with django using the API. To build the API you can use the Django Rest Framework.
Don't use the Django Admin as a public interface. Use that only for the admins!
If you start to use the Django Admin as interface for your public site, you'll fight with the package to tailor and secure the views to avoid destructive actions. What happen if you forget a readonly field? What if the user deleted something ON_CASCADE?
Building the UI you are totally free and you can customise easily everything without fighting the django admin package (it's awesome package but is not provided for public use)