Django application assistance? - python

Hi everyone I am new to django and could use help building an ERP system with it. Can anyone assist me, i have discord if you are interested in helping. I figured we could communicate better on it. Please help me with django I am going nuts

(Unfortunately I cannot comment because of low reputation points)
One of the first and most important steps of building a web application / service (that uses models) is to identify the needs and features and then implement them on models. You can start by working on your application's models and then the rest of development process will be easier to work on.

Related

contenttypes framework in Django

I am reading Django documentation (https://docs.djangoproject.com/en/3.0/ref/contrib/contenttypes/#module-django.contrib.contenttypes).
I did not understand content type app, the Django docs describe it as below
Django includes a contenttypes application that can track all of the models installed in your Django-powered project, providing a high-level, generic interface for working with your models.
Can someone explain this from beginner perspective ?
I have experience in developing websites in Django but never touched in this app.
Example: you want to make user-related logging, something like an audit module in user profile. You have dozen of models that could be logged. User, Order, Task, Product, etc.
So your main model will be something like AuditEntity.
How to make it general for all possible current (and future models) that could be logged here? Which type of field do you need?
The answer is Django contenttypes.
If you want - try to implement such a model's structure to understand how it works.
I think that what is trying to tell you is that you can have different content (in blocks, as it is organized in "blocks" and it is very "module friendly", I hope to give the idea), this content is made up of different things, especially models, let's just say that they are like big classes of things needed in your application (don't judge this expression, I know it is not professional but is the more beginner friendly I can write now), hope this makes more clear!

Storing admin username/password - FLASK-SQLAlchemy

I am currently learning programming and do not have much experience yet. I am making a webapp to manage employees (this is a personal project that I am only doing to learn from and is not going to be used by anyone) and I wanted to have a single admin user. I was wondering where I should store the username/password for that user. Even though this is just a personal project, I would learn more from trying to do it correctly, so that it could theoretically be used by someone.
Currently I am just storing the username and password-hash in the code itself, which I imagine is very bad practice.
So there are several options that you can do. If you are just getting started, for simplicity's sake, I would recommend you checkout Flask-User.
For state persistence, I would suggest you work with SQLite through Flask-SQLAlchemy. Don't bother with trying to spool up a whole database server for this.

Design Decision Django Rest Framework - Django as Frontend

I am currently developing my first more complex Web Application and want to ask for directions from more experienced Developers.
First I want to explain the most important requirements.
I want to develop a Web App (no mobile apps or desktop apps) and want to use as much django as possible. Because I am comfortable with the ecosystem right now and don't have that much time to learn something new that is too complex. I am inexperienced in the Javascript World, but I am able to do a little bit of jQuery.
The idea is to have one database and many different Frontends that are branded differently and have different users and administrators. So my current approach is to develop a Backend with Django and use Django Rest Framework to give the specific data to the Frontends via REST. Because I have not that much time to learn a Frontend-Framework I wanted to use another Django instance to use as a Frontend, as I really like the Django Template language. This would mean one Django instance one Frontend, where there would be mainly TemplateViews. The Frontends will be served on different subdomains, while the backend exposes the API Endpoints on the top level domain.
It is not necessary to have a Single Page App. A Normal Website with mainly the normal request/response-cycle is fine.
Do you think this is a possible approach to do things? I am currently thinking about how to use the data in the frontend sites in the best way. As I am familiar with the Django template language I thought about writing a middleware that asks about the user details in every request cycle from the backend. The thought is to use a request.user as normally as possible while getting the data from the backend.
Or is ist better to ask these details via jQuery and Ajax Calls and don't use the django template language very much?
Maybe there is also a way to make different Frontends for the same database without using REST?
Or what would you think about using a database with each frontend, which changes everytime I make a change in the main database in the backend? Although I don't really like this approach due to the possibility of differences in data if I make a mistake.
Hopefully this is not to confusing for you. If there are questions I will answer them happily. Maybe I am also totally on the wrong track. Please don't hesitate to point that out, too.
I thank you very much in advance for your guiding and wish you a nice day.
as per my experience and knowledge, you are almost going towards correct direction.
my recommendation is for making backend rest api Django and django rest framework is the best option however for consuming those api you can look for the angular or react both works very well in terms of consuming API.
Thank you for your input om tripathi.
I think it really does make sense to use the modern js frameworks for consuming a REST API.
I looked a little further into my problem and found multitenancy to fit my requirements perfectly. There are also great plugins and good reads for that use case. Just for others some informations I stumbled upon:
https://djangopackages.org/grids/g/multi-tenancy/
https://www.vinta.com.br/blog/2017/multitenancy-juggling-customer-data-django/
Especially the second link gave me information about different design approaches. For myself I chose to go the way with one database for every Client and then using the site framework from django to seperate data. For the Subdomain resolving I use django-hosts.
Thank you again and have a nice day.

Django user input steps needed

I'm a noob I know.
So I want to build a web app that allows the user to enter text. Then have the web server send an email based on the text with a message from another file.
What would be the optimal way to accomplish this? I am new to Django but have experience with Python. If someone could give me a basic bullet point way on how to do this I can google the rest. I just don't know where to start.
There is plenty of good guides online. The django documentation will take you step by step through making your first django app.
https://docs.djangoproject.com/en/1.9/intro/tutorial01/
Django has a sendmail library that you can use once you get your app started
https://docs.djangoproject.com/en/1.9/topics/email/
This guide is help you to go step by step
Tango with Django : http://www.tangowithdjango.com/book17/
Or
http://tutorial.djangogirls.org/en/index.html
as well you have to follow official documentation.because Tango with Django may cause version issues but Django girls tutorial seems updated.
Official : https://docs.djangoproject.com/en/1.9/intro/tutorial01/

A question about Django and Google Apps

Just wondering about this, is it possible to use Django with the Google Apps API's? I have a small organization that uses Google Apps Education Edition. I was thinking about making a small intranet using Django, and I would love if the first page they saw when they logged in had a few widgets with their email, calendar, maybe docs. I looked over some of the api's, and it seemed that getting the data was possible using the gdata library; but when I looked into using Django, all the search results returned pages about running Django on the app engine, nothing about Google Apps. Just looking for a little guidance, if anyone knew a page or a tutorial where someone had done this.
Thanks!
Yes, it is possible. This is not a question about Django and GAE in particular; you may have more luck searching for tutorials on using Django with generic web APIs.
Here's one I found almost immediately; it uses the del.icio.us API but the idea is the same.
Yes, it is. See this help topic.

Categories