One , Preface
There's a need :
You are very good : Give me a dump ctf Development tasks come here . What can only be a little : Let's develop the exercises first , We can do problems on Niuke .
This demand may be difficult for me two months ago , Now it's basically no difficulty for me . It took two days to take a basic look at the architecture 【 Because this is the first time to get all the source code 】 And adapted to the style of the examination section .
Two , Design logic
Since it's an examination module , There must be a lot of papers . Of course you can't write a bunch on the main page, can you , I designed a database to store the basic information of the test paper , Traverse the output at the front end .PS: This part was designed two months ago .

On the back end sql Database processing , Turn into python Object dictionary set , Traverse the output to the front end .
Yesterday, I designed the database of corresponding topics : The answer board is very similar to that of Niuke , The title is JavaScript Variable , Old acquaintance . I preliminarily designed the topic that should be stored + Options + answer + identification id.
Logic of thinking : Rely on... At the front end in the early stage :
<a href="{% url 'middle' %}?keyjobs={{a.id}}" >
Back end get To the identification of the test paper . Put it in a variable , To be used . use a Label transmission ,get
test_id=req.GET.get('keyjobs')
Then there is the linked database , Write a sql Tone , Processing data .
for var in results:
dict={
"questionId":var[0],
"questionTitle":var[1],
"questionItems":var[2],
"questionAnswer":var[3]
}
question_list.append(dict)
Do it sql Take out the data in the database , Convert to the dictionary set we need . Then loop and append to the list .
{"question_list":json.dumps(question_list)
The next step is to pass the value to the front end . Turn into json In the form of ,js Accept .
var data={{ question_list| safe }};
Optimized the previous basic structure , Removed a series of routes , Replace all pages with one page . The current view layer is as follows :
path('test/',views.testindex,name='testindex'),
path('middle/', views.middle,name="middle")
3、 ... and , Database design
Question number , Question title , Question options , The answer to the question , identification 【 Keep it 】.

adopt , The back-end statement processes the database , Extract it and convert it into json Pass it to the front end .
ok, Today, I caught a java Homework , It's true. I don't want to write articles in typing , Take a minute today , Make up for the next article tomorrow .
watch python Of imustctf Code , Change your mind , Write java The experiment is a little short circuited ...
