It is always interesting as a first step to find out if you have ever made such an app. Or is there a good open source application somewhere that can solve your problem. Just be careful not to add unnecessary complex apps with security issues or other issues while you have very minor problems. The intention is to find a long-term solution and perform as little development as possible, because those are all extra hours.
I always try to describe everything first in my head then in a document so that design is clear. I create a diagram in the form of Mindmap, Flowchart, Smart goals, and sometimes SWOT.
If something is certain to be useful, you start with development. You can start without analysis if you are sure this site needs an app and you already know a good one that you just want to adjust or install. Then there is actually no new app, but just an install. I think no analysis is necessary in this case.
Example:
We need a contact form that is linked to products.
It does not matter whether you start with a standard command or with a file app then you have standard structure in application file system.
admin.py apps.py forms.py __init__.py __init__.pyc models.py templates tests.py urls.py views.py
First I would recommend working top down and writing everything without running an application and without seeing how it works. Everything really top down.
You start with models then admin then forms and views and everything must be ready and completely without any run and view via browser. Because then you write the right structure and you think more about names instead of what works and what doesn't. For certain functions you can even start testing and write function content much later. The Top Down method helps you write fast and correct code. Code that people would enjoy reading.
Tips: Keep it simple, Don't repeat yourself, Function does only one thing, Application must have only one model.
Of course there are exceptions, but I see that applications work better and are easy to maintain if they respect such tips.
Here's an example of a model.
And admin file
When you create models with makemigrations command then you will fix all Errors in application..
python3 manage.py makemigrations permanentjob
python3 manage.py migrate permanentjob
If migration is out of sync. You can use this command to create your database with SQL.
python3 manage.py sqldiff permanentjob
Output will inform you about error and line in code file.
(admin.E108) The value of 'list_display[5]' refers to 'view_offer_link'
Improve all possible problems with your models. For example like this..
File "/home/sites/vacaturestoday/permanentjob/models.py", line 97, in <module>
class JobApplication(models.Model):
File "/home/sites/vacaturestoday/permanentjob/models.py", line 100, in JobApplication
job = models.ForeignKey('PermanentJob')
TypeError: __init__() missing 1 required positional argument: 'on_delete'
Or if you migrate not for working, you can use command.
python manage.py sqldiff
When you run the app in the browser then i will see more 500 errors. Improve them all. Do not forget to secure your development server with a firewall. :-) And allow only your own IP or develop on your own computer, roll it out only on the deployment server when it is ready... You can run the server on http://0.0.0.0:8080/ and use the domain for access.
In my opinion, development with VIM and command line in addition to application, speeds up your work and spares many hours of work.
Add a number of records and delete to make sure everything works as it expected.
Now you can start with testing your view and forms.
That's a helicopter view, these operations can sometimes take hours. Today I started with the application that was more or less ready and it took 2 hours for complete ready-to-use functionality. Of course it has to be used first and then you will see what you have to improve. Because users use it in a different way than developers. ☺😀😁😂
In the next step you can configure GUI. Nice filter for bootstrap and forms..
And finished!!! In view you have nothing more than standard logic.
As you can see this tutorial was more about the method that can optimize workflow, save your time and show the benefit of top down development method with django (python)
Comments
Post a Comment