0% found this document useful (0 votes)
15 views70 pages

School Enterprise

Uploaded by

SANDEEP KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views70 pages

School Enterprise

Uploaded by

SANDEEP KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

SCHOOL-ENTERPRISE COOPERATION ON PYTHON DATA

ANALYSIS TEACHING
A Mini Project thesis submitted to the JAWAHARLAL NEHRU

TECHNOLOGICAL UNIVERSITY HYDERABAD in partial fulfillment of


the requirement for the award of the degree of

BACHELOR OF TECHNOLOGY
In
Computer Science & Engineering
Submitted by

G.AKHILA 19D31A0536

G.AKANKSHA 19D31A0534

G.SHIVA 19D31A0539

Under the Guidance of


Mrs. V. CHAITHANYA
Dept. of CSE

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


INDUR INSTITUTE OF ENGINEERING & TECHNOLOGY(Affiliated to
J.N.T.University,Hyderabad)Ponnala(vil),Siddipet(Dist),Telangana State –
502277,Feb 2023

i
INDUR INSTITUTE OF ENGINEERING &
TECHNOLOGY

Ponnala(V),Siddipet(Mdl&Dist),Telangana State.PIN:50277

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Date: / /2023

CERTIFICATE

This is to certify that the thesis ‘SCHOOL-ENTERPRISE COOPERATION


ON PYTHON DATA ANALYSIS TEACHING’ being submitted by

G.AKHILA 19D31A0536

G.AKANKSHA 19D31A0534

G.SHIVA 19D31A0539
In a partial fulfillment for the award of Bachelor of Technology in Computer Science & Engg.
(B.Tech) to the Jawaharlal Nehru Technological University is a record of bonafide Mini Project
Work carried out by them under our guidance and supervision.
The results embodied in this thesis have not been submitted to any other University or
Institute for the award of any degree or diploma.

Mrs.V.CHAITHANYA Mr.RITESH THAKUR

Project Guide Head


Asst prof,Dept.of.CSE Dept.of.CSE
Indur Institute of Engineering & Indur Institute of Engineering &
Technology,Siddipet Technology,Siddipet

EXTERNAL EXAMINER

ii
ACKNOWLEDGEMENT

We are thankful to Mrs. V. CHAITHANYA , Asst Prof., Project Guide, Dept. Of


CSE who guided us a lot by her favorable suggestions to complete our project. She is the
research oriented personality with higher end technical exposure.

We are thankful to Mr. RITESH THAKUR ,Prof & Head, Dept. of CSE, Indur
Institute of Engineering & Technology, for extending his help in the department academic
activities in the course duration. He is the personality of dynamic, enthusiastic in the academic
activities.

We extend our thanks to Dr. V.P. Raju Principal, Indur Institute of Engineering &
Technology, Siddipet for extending his help through out the duration of this project.

We sincerely acknowledge to all the lecturers of the Dept. of CSE for their motivation
during our B.Tech course.

We would like to say thanks to all of my friends for their timely help and encouragement.

G.AKHILA 19D31A0536

G.AKANKSHA 19D31A0534

G.SHIVA 19D31A0539

iii
DECLARATION

We here by declare that the project work entitled “SCHOOL-ENTERPRISE


COOPERATION ON PYTHON DATA ANALYSIS TEACHING”. Submitted to the
university, is a record of an original work done by us under the guidance of to Mrs.
V.CHAITHANYA Department of Computer Science & Engineering INDUR INSTITUTE OF
ENGINEERING &TECHNOLOGY, and this project work has not formed the basis for the
award of any degree or diploma associate ship\fellowship and any other similar titles if any.

G.AKHILA 19D31A0536

G.AKANKSHA 19D31A0534

G.SHIVA 19D31A0539

iv
ABSTRACT

To meet the needs of enterprises for data analysis talents, school-enterprise cooperative
course Python Data Analysis introduces the basic theories and methods for data analysis by using
the Python programming language. The teaching content is organized around practical cases
designed according to the actual demand of the enterprise. Exploratory teaching methods are
conducted to cultivate the communication, collaboration, critical thinking and creativity ability of
students. Students fully participate in the teaching process by discussing, analysing and
programming the cases. The implementation scheme, organization of exploratory teaching and the
design of teaching cases are introduced in this project.

v
CONTENTS

CHAPTER NO. TITLE PAGE NO.

1 INTRODUCTION 1
2 LITERATURE SURVEY 2
3 SYSTEM ANALYSIS 3-32
3.1 Existing System 3
3.1.1 Disadvantages of existing system 3
3.2 proposed System 4
3.2.1 Advantages of proposed system 4
3.3 System Requirements 4-5
3.3.1 Hardware Requirements 4
3.3.2 Software Requirements 5
3.4 System Study 5-6
3.4.1 Feasibility study 5-6
3.5 System Specifications 6-7
3.5.1 Python 8-22
3.5.2 Django 23-32
4 SYSTEM DESIGN 33-39
4.1 System Architecture 33
4.2 Data Flow Diagram 33-34
4.3 UML Diagrams 35-39
4.3.1 Use Case Diagram 36
4.3.2 Class Diagram 37
4.3.3 Sequence Diagram 37-38
4.3.4 Activity Diagram 39

5 IMPLEMENTATION 40-41
5.1 Module 40-41

vi
6 RESULTS 42-45
6.1 Homepage 42
6.2 Teacher Login 42
6.3 Teacher Home 43
6.4 Student Login 43
6.5 Student Home 44
6.6 Student Assignment 44
6.7 Student Marks 45
6.8 Admin Login 45
7 SYSTEM TESTING 46-51
7.1 Unit Testing 46
7.2 Integration Testing 46
7.3 White Box Testing 47
7.4 Black Box Testing 48
7.5 Acceptance Testing 49
8 CONCLUSION & FUTURE IMPROVEMENT 52
8.1 Conclusion 52
8.2 Future Enhancement 52
9 BIBILOGRAPHY 53
10 APPENDICES 54-60

vii
LIST OF FIGURES
3.1 MTV Architecture 23
3.2 Django Architecture 24
4.1 System Architecture 33
4.2 Data Flow Diagram 34
4.3.1 Use Case Diagram 36
4.3.2 Class Diagram 37
4.3.3 Sequence Diagram 38
4.3.4 Activity Diagram 39
6.1 Home Page 42
6.2 Teacher Login 42
6.3 Teacher Home 43
6.4 Student Login 43
6.5 Student Home 44
6.6 Student Assignment 44
6.7 Student Marks 45
6.8 Admin Login 45

viii
LIST OF TABLES

7.1 Sample Test Cases 50-51

ix
[Type here]
CHAPTER-1
INTRODUCTION
Python Data Analysis is a school-enterprise cooperative course supported by the Ministry
of Education of China. School-enterprise cooperation program aims to deepen integration
between industry and education by building the courses that meet the needs of enterprises. With
the development of mobile Internet, Internet of Things and artificial intelligence, more and
more disciplines are on the basis of computation, such as computational physics, computational
chemistry, and computational biology and so on. Data analysis technique, that is to discover
useful information, suggest conclusions, and support decision-making, has become a basic
supporting technique of computation. Python Data Analysis course introduces the basic
theories and methods for data acquisition, processing, modeling and analysis by using Python
programming language. This course is suitable for anyone who wants to perform data analysis.
Python is a concise and efficient programming language preferred as the entry language for
programming. Python provides a rich third-party library for data analysis that enables learners
to focus on problem solving. After learning this course, students will gain the basic data
analysis ability as well as computational thinking for research and practice in all scientific
fields they engage in. Reform is conducted on both the teaching content and teaching method.
The teaching content is organized around practical cases designed according to the actual
demand of enterprises. Exploratory teaching methods are conducted to cultivate the
communication, collaboration, critical thinking and creativity ability of students. Students fully
participate in the teaching process by discussing, analyzing and solving cases. The rest of this
paper is organized as follows. We begin with the introduction of data analysis courses in
universities in Section 2. The design of teaching cases is proposed in Section 3, and the
implementation scheme and organization of exploratory teaching are presented .

1
CHAPTER-2
LITERATURE SURVEY
1) A research framework of smart education

AUTHORS: Zhi-Ting Zhu, Ming-Hua Yu , Peter Riezebos, Min Goong 2 , Changhua Sun2
, Jin Huang2 .
The development of new technologies enables learners to learn more effectively, efficiently,
flexibly and comfortably. Learners utilize smart devices to access digital resources through
wireless networks and to immerse in both personalized and seamless learning. Smart
education, a concept that describes learning in the digital age, has gained increased attention.
This paper discusses the definition of smart education and presents a conceptual framework.
A four-tier framework of smart pedagogies and ten key features of smart learning
environments are proposed for fostering smart learners who need master knowledge and
skills of 21st century learning. The smart pedagogy framework includes class-based
differentiated instruction, group-based collaborative learning, individual-based personalized
learning and mass-based generative learning. Furthermore, a technological architecture of
smart education, which emphasizes the role of smart computing, is proposed. The tri-tier
architecture and key functions are all presented. Finally, challenges of smart education are
discussed.

2
CHAPTER-3
SYSTEM ANALYSIS
School-Enterprise Cooperation on Python Data Analysis Teaching

To meet the needs of enterprises for data analysis talents, school-enterprise cooperative course
Python Data Analysis introduces the basic theories and methods for data analysis by using the
Python programming language. The teaching content is organized around practical cases
designed according to the actual demand of the enterprise. Exploratory teaching methods are
conducted to cultivate the communication, collaboration, critical thinking and creativity ability
of students. Students fully participate in the teaching process by discussing, analyzing and
programming the cases. The implementation scheme, organization of exploratory teaching and
the design of teaching cases are introduced in this paper. Index Terms—School-enterprise
cooperation, Python, data.

3.1 EXISTING SYSTEM:

The potential of artificial intelligence technology is undoubtedly magnificent. As the most


widely used technology possessing the highest theoretical research value in artificial
intelligence. Early machine learning courses are mainly set up for postgraduate students with
majors of Computer and Artificial Intelligence. With the advent of the artificial intelligence
and big data age, it is necessary to set up machine learning courses in undergraduates.

3.1.1 DISADVANTAGES OF EXISTING SYSTEM:

⮚ The ability to collect, store, manage and process data has been difficult in existing
methods.
⮚ The stage of artificial intelligence is also defined as a discipline about knowledge,
namely the technology about how to acquire and express the knowledge and convert it
into practical applications

3
3.2 PROPOSED SYSTEM:

School-enterprise cooperation program aims to deepen integration between industry


and education by building the courses that meet the needs of enterprises.

Data analysis technique, that is to discover useful information, suggest conclusions, and
support decision-making, has become a basic supporting technique of computation. Python
Data Analysis course introduces the basic theories and methods for data acquisition,
processing, modeling and analysis by using Python programming language. This course is
suitable for anyone who wants to perform data analysis. Python is a concise and efficient
programming language preferred as the entry language for programming.

3.2.1 ADVANTAGES OF PROPOSED SYSTEM:

After learning this course, students will gain the basic data analysis ability as well as
computational thinking for research and practice in all scientific fields they engage in.

Ability to make faster, more informed business decisions, backed up by facts.Deeper


understanding of customer requirements which, in turn, builds better business
relationships.Improved flexibility and greater capability in order to react to change - both
within the business and the market.

3.3 SYSTEM REQUIREMENTS:

3.3.1HARDWARE REQUIREMENTS:

⮚ System : Pentium Dual Core.


⮚ Hard Disk : 500 GB.
⮚ Monitor : 15’’ LED
⮚ Input Devices : Keyboard, Mouse
⮚ Ram : 1GB.

4
3.3.2 SOFTWARE REQUIREMENTS:

⮚ Operating system : Windows 7.


⮚ Coding Language : Python
⮚ Tool : PyCharm, Visual Studio Code
⮚ Database : sqlite.

3.4 SYSTEM STUDY:


3.4.1 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is
put forth with a very general plan for the project and some cost estimates. During system
analysis the feasibility study of the proposed system is to be carried out. This is to ensure that
the proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.
Three key considerations involved in the feasibility analysis are,

 ECONOMICAL FEASIBILITY
 TECHNICAL FEASIBILITY
 SOCIAL FEASIBILITY

ECONOMICAL FEASIBILITY

This study is carried out to check the economic impact that the system will have on
the organization. The amount of fund that the company can pour into the research and
development of the system is limited. The expenditures must be justified. Thus the developed
system as well within the budget and this was achieved because most of the technologies used
are freely available. Only the customized products had to be purchased.

5
TECHNICAL FEASIBILITY

This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on the
available technical resources. This will lead to high demands on the available technical
resources. This will lead to high demands being placed on the client. The developed system
must have a modest requirement, as only minimal or null changes are required for
implementing this system.

SOCIAL FEASIBILITY

The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not feel
threatened by the system, instead must accept it as a necessity. The level of acceptance by the
users solely depends on the methods that are employed to educate the user about the system
and to make him familiar with it. His level of confidence must be raised so that he is also able
to make some constructive criticism, which is welcomed, as he is the final user of the system.

3.5 SYSTEM SPECIFICATION:

HARDWARE REQUIREMENTS:

❖ System : Pentium IV 2.4 GHz.

❖ Hard Disk : 40 GB.

❖ Floppy Drive : 1.44 Mb.

❖ Monitor : 14’ Colour Monitor.

❖ Mouse : Optical Mouse.

❖ Ram : 512 Mb.

6
SOFTWARE REQUIREMENTS:

❖ Operating system : Windows 7 Ultimate.

❖ Coding Language : Python.

❖ Front-End : Python.

❖ Designing : Html,css,javascript.

❖ Data Base : MySQL.

7
3.5.1 PYTHON

Python is a general-purpose interpreted, interactive, object-oriented, and high-level


programming language. An interpreted language, Python has a design philosophy that
emphasizes code readability (notably using whitespace indentation to delimit code
blocks rather than curly brackets or keywords), and a syntax that allows programmers to
express concepts in fewer lines of code than might be used in languages such as C++or Java. It
provides constructs that enable clear programming on both small and large scales. Python
interpreters are available for many operating systems. CPython, the reference
implementation of Python, is open source software and has a community-based development
model, as do nearly all of its variant implementations. CPython is managed by the non-
profit Python Software Foundation. Python features a dynamic type system and
automatic memory management. It supports multiple programming paradigms,
including object-oriented, imperative, functional and procedural, and has a large and
comprehensive standard library.

Interactive Mode Programming

Invoking the interpreter without passing a script file as a parameter brings up the following
prompt −

$ python

Python 2.4.3 (#1, Nov 11 2010, 13:34:43)

[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>

Type the following text at the Python prompt and press the Enter −

>>> print "Hello, Python!"

If you are running new version of Python, then you would need to use print statement with
parenthesis as in print ("Hello, Python!");. However in Python version 2.4.3, this produces the
following result −
8
Hello, Python!

Script Mode Programming

Invoking the interpreter with a script parameter begins execution of the script and continues
until the script is finished. When the script is finished, the interpreter is no longer active.

Let us write a simple Python program in a script. Python files have extension .py. Type the
following source code in a test.py file −

Live Demo

print "Hello, Python!"

We assume that you have Python interpreter set in PATH variable. Now, try to run this program
as follows −

$ python test.py

This produces the following result −

Hello, Python!

Let us try another way to execute a Python script. Here is the modified test.py file −

Live Demo

#!/usr/bin/python

print "Hello, Python!"

We assume that you have Python interpreter available in /usr/bin directory. Now, try to run this
program as follows −

$ chmod +x test.py # This is to make file executable

$./test.py

This produces the following result −

Hello, Python!

9
Python Identifiers

A Python identifier is a name used to identify a variable, function, class, module or


other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by
zero or more letters, underscores and digits (0 to 9).

Python does not allow punctuation characters such as @, $, and % within identifiers. Python is
a case sensitive programming language. Thus, Manpower and manpower are two different
identifiers in Python.

Here are naming conventions for Python identifiers −

Class names start with an uppercase letter. All other identifiers start with a lowercase letter.

Starting an identifier with a single leading underscore indicates that the identifier is private.

Starting an identifier with two leading underscores indicates a strongly private identifier.

If the identifier also ends with two trailing underscores, the identifier is a language-defined
special name.

Reserved Words

The following list shows the Python keywords. These are reserved words and you cannot use
them as constant or variable or any other identifier names. All the Python keywords contain
lowercase letters only.

and exec not

assert finally or

break for pass

class from print

continue global raise

def if return

10
del import try

elif in while

else is with

except lambdayield

Lines and Indentation

Python provides no braces to indicate blocks of code for class and function definitions or flow
control. Blocks of code are denoted by line indentation, which is rigidly enforced.

The number of spaces in the indentation is variable, but all statements within the block must
be indented the same amount. For example −

if True:

print "True"

else:

print "False"

However, the following block generates an error −

if True:

print "Answer"

print "True"

else:

print "Answer"

print "False"

Thus, in Python all the continuous lines indented with same number of spaces would form a
block. The following example has various statement blocks −

11
Note − Do not try to understand the logic at this point of time. Just make sure you understood
various blocks even if they are without braces.

#!/usr/bin/python

import sys

try:

# open file stream

file = open(file_name, "w")

except IOError:

print "There was an error writing to", file_name

sys.exit()

print "Enter '", file_finish,

print "' When finished"

while file_text != file_finish:

file_text = raw_input("Enter text: ")

if file_text == file_finish:

# close the file

file.close

break

file.write(file_text)

file.write("\n")

file.close()

file_name = raw_input("Enter filename: ")

if len(file_name) == 0:

print "Next time please enter something"

sys.exit()

12
try:

file = open(file_name, "r")

except IOError:

print "There was an error reading file"

sys.exit()

file_text = file.read()

file.close()

print file_text

Multi-Line Statements

Statements in Python typically end with a new line. Python does, however, allow the use of the
line continuation character (\) to denote that the line should continue. For example −

total = item_one + \

item_two + \

item_three

Statements contained within the [], {}, or () brackets do not need to use the line continuation
character. For example −

days = ['Monday', 'Tuesday', 'Wednesday',

'Thursday', 'Friday']

Quotation in Python

Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long
as the same type of quote starts and ends the string.

The triple quotes are used to span the string across multiple lines. For example, all the following
are legal −

word = 'word'

sentence = "This is a sentence."

13
paragraph = """This is a paragraph. It is

made up of multiple lines and sentences."""

Comments in Python

A hash sign (#) that is not inside a string literal begins a comment. All characters after the #
and up to the end of the physical line are part of the comment and the Python interpreter ignores
them.

Live Demo

#!/usr/bin/python

# First comment

print "Hello, Python!" # second comment

This produces the following result −

Hello, Python!

You can type a comment on the same line after a statement or expression −

name = "Madisetti" # This is again comment

You can comment multiple lines as follows –

# This is a comment.

# This is a comment, too.

# This is a comment, too.

# I said that already.

Following triple-quoted string is also ignored by Python interpreter and can be used as a
multiline comments:

'''

This is a multiline

comment.

'''

14
Using Blank Lines

A line containing only whitespace, possibly with a comment, is known as a blank line and
Python totally ignores it.

In an interactive interpreter session, you must enter an empty physical line to terminate a
multiline statement.

Waiting for the User

The following line of the program displays the prompt, the statement saying “Press the enter
key to exit”, and waits for the user to take action −

#!/usr/bin/python

raw_input("\n\nPress the enter key to exit.")

Here, "\n\n" is used to create two new lines before displaying the actual line. Once the user
presses the key, the program ends. This is a nice trick to keep a console window open until the
user is done with an application.

Multiple Statements on a Single Line

The semicolon ( ; ) allows multiple statements on the single line given that neither statement
starts a new code block. Here is a sample snip using the semicolon.

import sys; x = 'foo'; sys.stdout.write(x + '\n')

Multiple Statement Groups as Suites

A group of individual statements, which make a single code block are called suites in Python.
Compound or complex statements, such as if, while, def, and class require a header line and a
suite.

Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are
followed by one or more lines which make up the suite. For example −

if expression :

suite

elif expression :

suite

15
else :

suite

Command Line Arguments

Many programs can be run to provide you with some basic information about how they should
be run. Python enables you to do this with -h −

$ python -h

usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...

Options and arguments (and corresponding environment variables):

-c cmd : program passed in as string (terminates option list)

-d : debug output from parser (also PYTHONDEBUG=x)

-E : ignore environment variables (such as PYTHONPATH)

-h : print this help message and exit

You can also program your script in such a way that it should accept various options. Command
Line Arguments is an advanced topic and should be studied a bit later once you have gone
through rest of the Python concepts.

Python Lists

The list is a most versatile datatype available in Python which can be written as a list of comma-
separated values (items) between square brackets. Important thing about a list is that items in
a list need not be of the same type.

Creating a list is as simple as putting different comma-separated values between square


brackets. For example −

list1 = ['physics', 'chemistry', 1997, 2000];

list2 = [1, 2, 3, 4, 5 ];

list3 = ["a", "b", "c", "d"]

Similar to string indices, list indices start at 0, and lists can be sliced, concatenated and so on.

16
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The
differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples
use parentheses, whereas lists use square brackets.

Creating a tuple is as simple as putting different comma-separated values. Optionally you can
put these comma-separated values between parentheses also. For example −

tup1 = ('physics', 'chemistry', 1997, 2000);

tup2 = (1, 2, 3, 4, 5 );

tup3 = "a", "b", "c", "d";

The empty tuple is written as two parentheses containing nothing −

tup1 = ();

To write a tuple containing a single value you have to include a comma, even though there is
only one value −

tup1 = (50,);

Like string indices, tuple indices start at 0, and they can be sliced, concatenated, and so on.

Accessing Values in Tuples

To access values in tuple, use the square brackets for slicing along with the index or indices to
obtain value available at that index. For example –

Live Demo

#!/usr/bin/python

tup1 = ('physics', 'chemistry', 1997, 2000);

tup2 = (1, 2, 3, 4, 5, 6, 7 );

print "tup1[0]: ", tup1[0];

print "tup2[1:5]: ", tup2[1:5];

When the above code is executed, it produces the following result −

tup1[0]: physics

tup2[1:5]: [2, 3, 4, 5]

17
Updating Tuples

Accessing Values in Dictionary

To access dictionary elements, you can use the familiar square brackets along with the key to
obtain its value. Following is a simple example −

Live Demo

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

print "dict['Name']: ", dict['Name']

print "dict['Age']: ", dict['Age']

When the above code is executed, it produces the following result −

dict['Name']: Zara

dict['Age']: 7

If we attempt to access a data item with a key, which is not part of the dictionary, we get an
error as follows −

Live Demo

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

print "dict['Alice']: ", dict['Alice']

When the above code is executed, it produces the following result −

dict['Alice']:

Traceback (most recent call last):

File "test.py", line 4, in <module>

print "dict['Alice']: ", dict['Alice'];

KeyError: 'Alice'

Updating Dictionary

18
You can update a dictionary by adding a new entry or a key-value pair, modifying an existing
entry, or deleting an existing entry as shown below in the simple example −

Live Demo

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

dict['Age'] = 8; # update existing entry

dict['School'] = "DPS School"; # Add new entry

print "dict['Age']: ", dict['Age']

print "dict['School']: ", dict['School']

When the above code is executed, it produces the following result −

dict['Age']: 8

dict['School']: DPS School

Delete Dictionary Elements

You can either remove individual dictionary elements or clear the entire contents of a
dictionary. You can also delete entire dictionary in a single operation.

To explicitly remove an entire dictionary, just use the del statement. Following is a simple
example −

Live Demo

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

del dict['Name']; # remove entry with key 'Name'

dict.clear(); # remove all entries in dict

del dict ; # delete entire dictionary

print "dict['Age']: ", dict['Age']

19
print "dict['School']: ", dict['School']

This produces the following result. Note that an exception is raised because after del dict
dictionary does not exist any more −

dict['Age']:

Traceback (most recent call last):

File "test.py", line 8, in <module>

print "dict['Age']: ", dict['Age'];

TypeError: 'type' object is unsubscriptable

Note − del() method is discussed in subsequent section.

Properties of Dictionary Keys

Dictionary values have no restrictions. They can be any arbitrary Python object, either
standard objects or user-defined objects. However, same is not true for the keys.

There are two important points to remember about dictionary keys −

(a) More than one entry per key not allowed. Which means no duplicate key is allowed. When
duplicate keys encountered during assignment, the last assignment wins. For example −

Live Demo

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7, 'Name': 'Manni'}

print "dict['Name']: ", dict['Name']

When the above code is executed, it produces the following result −

dict['Name']: Manni

(b) Keys must be immutable. Which means you can use strings, numbers or tuples as dictionary
keys but something like ['key'] is not allowed. Following is a simple example −

Live Demo

20
#!/usr/bin/python

dict = {['Name']: 'Zara', 'Age': 7}

print "dict['Name']: ", dict['Name']

When the above code is executed, it produces the following result −

Traceback (most recent call last):

File "test.py", line 3, in <module>

dict = {['Name']: 'Zara', 'Age': 7};

TypeError: unhashable type: 'list'

Tuples are immutable which means you cannot update or change the values of tuple elements.
You are able to take portions of existing tuples to create new tuples as the following example
demonstrates −

Live Demo

#!/usr/bin/python

tup1 = (12, 34.56);

tup2 = ('abc', 'xyz');

# Following action is not valid for tuples

# tup1[0] = 100;

# So let's create a new tuple as follows

tup3 = tup1 + tup2;

print tup3;

When the above code is executed, it produces the following result −

(12, 34.56, 'abc', 'xyz')

Delete Tuple Elements

Removing individual tuple elements is not possible. There is, of course, nothing wrong with
putting together another tuple with the undesired elements discarded.

21
To explicitly remove an entire tuple, just use the del statement. For example −

Live Demo

#!/usr/bin/python

tup = ('physics', 'chemistry', 1997, 2000);

print tup;

del tup;

print "After deleting tup : ";

print tup;

This produces the following result. Note an exception raised, this is because after del tup tuple
does not exist any more −

('physics', 'chemistry', 1997, 2000)

After deleting tup :

Traceback (most recent call last):

File "test.py", line 9, in <module>

print tup;

NameError: name 'tup' is not defined

22
3.5.2 DJANGO

Django is a high-level Python Web framework that encourages rapid development and
clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle
of Web development, so you can focus on writing your app without needing to reinvent the
wheel. It’s free and open source.

Django's primary goal is to ease the creation of complex, database-driven websites. Django
emphasizes reusability and "pluggability" of components, rapid development, and the principle
of don't repeat yourself. Python is used throughout, even for settings files and data models.

Fig:3.1:MTV Architecture

Django also provides an optional administrative create, read, update and delete interface that
is generated dynamically through introspection and configured via admin models

23
Fig:3.2: Django Architecture

Create a Project

Whether you are on Windows or Linux, just get a terminal or a cmd prompt and navigate to
the place you want your project to be created, then use this code −

$ django-admin startproject myproject

This will create a "myproject" folder with the following structure −

myproject/

manage.py

myproject/

__init__.py

settings.py

urls.py

wsgi.py

The Project Structure

The “myproject” folder is just your project container, it actually contains two elements −

24
manage.py − This file is kind of your project local django-admin for interacting with your
project via command line (start the development server, sync db...). To get a full list of
command accessible via manage.py you can use the code −

$ python manage.py help

The “myproject” subfolder − This folder is the actual python package of your project. It
contains four files −

__init__.py − Just for python, treat this folder as package.

settings.py − As the name indicates, your project settings.

urls.py − All links of your project and the function to call. A kind of ToC of your project.

wsgi.py − If you need to deploy your project over WSGI.

Setting Up Your Project

Your project is set up in the subfolder myproject/settings.py. Following are some important
options you might need to set −

DEBUG = True

This option lets you set if your project is in debug mode or not. Debug mode lets you get more
information about your project's error. Never set it to ‘True’ for a live project. However, this
has to be set to ‘True’ if you want the Django light server to serve static files. Do it only in the
development mode.

DATABASES = {

'default': {

'ENGINE': 'django.db.backends.sqlite3',

'NAME': 'database.sql',

'USER': '',

'PASSWORD': '',

'HOST': '',

25
'PORT': '',

Database is set in the ‘Database’ dictionary. The example above is for SQLite engine. As stated
earlier, Django also supports −

MySQL (django.db.backends.mysql)

PostGreSQL (django.db.backends.postgresql_psycopg2)

Oracle (django.db.backends.oracle) and NoSQL DB

MongoDB (django_mongodb_engine)

Before setting any new engine, make sure you have the correct db driver installed.

You can also set others options like: TIME_ZONE, LANGUAGE_CODE, TEMPLATE…

Now that your project is created and configured make sure it's working −

$ python manage.py runserver

You will get something like the following on running the above code −

Validating models...

0 errors found

September 03, 2015 - 11:41:50

Django version 1.6.11, using settings 'myproject.settings'

Starting development server at http://127.0.0.1:8000/

Quit the server with CONTROL-C.

A project is a sum of many applications. Every application has an objective and can be reused
into another project, like the contact form on a website can be an application, and can be reused
for others. See it as a module of your project.

26
Create an Application

We assume you are in your project folder. In our main “myproject” folder, the same folder then
manage.py −

$ python manage.py startapp myapp

You just created myapp application and like project, Django create a “myapp” folder with the
application structure −

myapp/

__init__.py

admin.py

models.py

tests.py

views.py

__init__.py − Just to make sure python handles this folder as a package.

admin.py − This file helps you make the app modifiable in the admin interface.

models.py − This is where all the application models are stored.

tests.py − This is where your unit tests are.

views.py − This is where your application views are.

Get the Project to Know About Your Application

At this stage we have our "myapp" application, now we need to register it with our Django
project "myproject". To do so, update INSTALLED_APPS tuple in the settings.py file of your
project (add your app name) −

INSTALLED_APPS = (

'django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

27
'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles',

'myapp',

Creating forms in Django, is really similar to creating a model. Here again, we just need to
inherit from Django class and the class attributes will be the form fields. Let's add a forms.py
file in myapp folder to contain our app forms. We will create a login form.

myapp/forms.py

#-*- coding: utf-8 -*-

from django import forms

class LoginForm(forms.Form):

user = forms.CharField(max_length = 100)

password = forms.CharField(widget = forms.PasswordInput())

As seen above, the field type can take "widget" argument for html rendering; in our case, we
want the password to be hidden, not displayed. Many others widget are present in Django:
DateInput for dates, CheckboxInput for checkboxes, etc.

Using Form in a View

There are two kinds of HTTP requests, GET and POST. In Django, the request object passed
as parameter to your view has an attribute called "method" where the type of the request is set,
and all data passed via POST can be accessed via the request.POST dictionary.

Let's create a login view in our myapp/views.py −

#-*- coding: utf-8 -*-

from myapp.forms import LoginForm

def login(request):

username = "not logged in"

28
if request.method == "POST":

#Get the posted form

MyLoginForm = LoginForm(request.POST)

if MyLoginForm.is_valid():

username = MyLoginForm.cleaned_data['username']

else:

MyLoginForm = Loginform()

return render(request, 'loggedin.html', {"username" : username})

The view will display the result of the login form posted through the loggedin.html. To test it,
we will first need the login form template. Let's call it login.html.

<html>

<body>

<form name = "form" action = "{% url "myapp.views.login" %}"

method = "POST" >{% csrf_token %}

<div style = "max-width:470px;">

<center>

<input type = "text" style = "margin-left:20%;"

placeholder = "Identifiant" name = "username" />

</center>

</div>

<br>

<div style = "max-width:470px;">

<center>

<input type = "password" style = "margin-left:20%;"

placeholder = "password" name = "password" />

29
</center>

</div>

<br>

<div style = "max-width:470px;">

<center>

<button style = "border:0px; background-color:#4285F4; margin-top:8%;

height:35px; width:80%;margin-left:19%;" type = "submit"

value = "Login" >

<strong>Login</strong>

</button>

</center>

</div>

</form>

</body>

</html>

The template will display a login form and post the result to our login view above. You have
probably noticed the tag in the template, which is just to prevent Cross-site Request Forgery
(CSRF) attack on your site.

{% csrf_token %}

Once we have the login template, we need the loggedin.html template that will be rendered
after form treatment.

<html>

<body>

You are : <strong>{{username}}</strong>

</body>

30
</html>

Now, we just need our pair of URLs to get started: myapp/urls.py

from django.conf.urls import patterns, url

from django.views.generic import TemplateView

urlpatterns = patterns('myapp.views',

url(r'^connection/',TemplateView.as_view(template_name = 'login.html')),

url(r'^login/', 'login', name = 'login'))

When accessing "/myapp/connection", we will get the following login.html template rendered

Setting Up Sessions

In Django, enabling session is done in your project settings.py, by adding some lines to the
MIDDLEWARE_CLASSES and the INSTALLED_APPS options. This should be done while
creating the project, but it's always good to know, so MIDDLEWARE_CLASSES should have

'django.contrib.sessions.middleware.SessionMiddleware'

And INSTALLED_APPS should have −

'django.contrib.sessions'

By default, Django saves session information in database (django_session table or collection),


but you can configure the engine to store information using other ways like: in file or in cache.

When session is enabled, every request (first argument of any view in Django) has a session
(dict) attribute.

Let's create a simple sample to see how to create and save sessions. We have built a simple
login system before (see Django form processing chapter and Django Cookies Handling
chapter). Let us save the username in a cookie so, if not signed out, when accessing our login
page you won’t see the login form. Basically, let's make our login system we used in Django
Cookies handling more secure, by saving cookies server side.

For this, first lets change our login view to save our username cookie server side −

31
def login(request):

username = 'not logged in'

if request.method == 'POST':

MyLoginForm = LoginForm(request.POST)

if MyLoginForm.is_valid():

username = MyLoginForm.cleaned_data['username']

request.session['username'] = username

else:

MyLoginForm = LoginForm()

return render(request, 'loggedin.html', {"username" : username}

Then let us create formView view for the login form, where we won’t display the form if cookie
is set −

def formView(request):

if request.session.has_key('username'):

username = request.session['username']

return render(request, 'loggedin.html', {"username" : username})

else:

return render(request, 'login.html', {})

Now let us change the url.py file to change the url so it pairs with our new view −

from django.conf.urls import patterns, url

from django.views.generic import TemplateView

urlpatterns = patterns('myapp.views',

url(r'^connection/','formView', name = 'loginform'),

url(r'^login/', 'login', name = 'login'))

When accessing /myapp/connection, you will get to see the

32
CHAPTER-4

SYSTEM DESIGN

4.1 SYSTEM ARCHITECTURE:

Fig:4.1: System Architecture

4.2 DATA FLOW DIAGRAM:


1. The DFD is also called as bubble chart. It is a simple graphical formalism that can be
used to represent a system in terms of input data to the system, various processing carried out
on this data, and the output data is generated by this system.
2. The data flow diagram (DFD) is one of the most important modeling tools. It is used
to model the system components. These components are the system process, the data used by
the process, an external entity that interacts with the system and the information flows in the
system.
3. DFD shows how the information moves through the system and how it is modified by
a series of transformations. It is a graphical technique that depicts information flow and the
transformations that are applied as data moves from input to output.
4. DFD is also known as bubble chart. A DFD may be used to represent a system at any
level of abstraction. DFD may be partitioned into levels that represent increasing information
flow and functional detail

33
Fig:4.2:Data Flow Diagram

34
4.3 UML DIAGRAMS
UML stands for Unified Modeling Language. UML is a standardized general-purpose
modeling language in the field of object-oriented software engineering. The standard is
managed, and was created by, the Object Management Group.
The goal is for UML to become a common language for creating models of object oriented
computer software. In its current form UML is comprised of two major components: a Meta-
model and a notation. In the future, some form of method or process may also be added to; or
associated with, UML.
The Unified Modeling Language is a standard language for specifying, Visualization,
Constructing and documenting the artifacts of software system, as well as for business
modeling and other non-software systems.
The UML represents a collection of best engineering practices that have proven successful in
the modeling of large and complex systems.
The UML is a very important part of developing objects oriented software and the software
development process. The UML uses mostly graphical notations to express the design of
software projects.

GOALS:
The Primary goals in the design of the UML are as follows:
1. Provide users a ready-to-use, expressive visual modeling Language so that they can
develop and exchange meaningful models.
2. Provide extendibility and specialization mechanisms to extend the core concepts.
3. Be independent of particular programming languages and development process.
4. Provide a formal basis for understanding the modeling language.
5. Encourage the growth of OO tools market.
6. Support higher level development concepts such as collaborations, frameworks,
patterns and components.
7. Integrate best practices.

35
4.3.1 USE CASE DIAGRAM:
A use case diagram in the Unified Modeling Language (UML) is a type of behavioral
diagram defined by and created from a Use-case analysis. Its purpose is to present a graphical
overview of the functionality provided by a system in terms of actors, their goals (represented
as use cases), and any dependencies between those use cases. The main purpose of a use case
diagram is to show what system functions are performed for which actor. Roles of the actors
in the system can be depicted.

Fig:4.3.1:Use Case Diagram

36
4.3.2 CLASS DIAGRAM:

In software engineering, a class diagram in the Unified Modeling Language (UML) is a type
of static structure diagram that describes the structure of a system by showing the system's
classes, their attributes, operations (or methods), and the relationships among the classes. It
explains which class contains information

Fig:4.3.2:Class Diagram

4.3.3 SEQUENCE DIAGRAM:

A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram


that shows how processes operate with one another and in what order. It is a construct of a
Message Sequence Chart. Sequence diagrams are sometimes called event diagrams, event
scenarios, and timing diagrams.

37
Fig:4.3.3:Sequence Diagram

38
4.3.4 ACTIVITY DIAGRAM:

Activity diagrams are graphical representations of workflows of stepwise activities and actions
with support for choice, iteration and concurrency. In the Unified Modeling Language, activity
diagrams can be used to describe the business and operational step-by-step workflows of
components in a system. An activity diagram shows the overall flow of control

Fig:4.3.4:Activity Diagram

39
CHAPTER-5
IMPLEMENTATION
5.1 MODULES:
● Teacher
● Student
● Admin
● Python and Data-analysis

Teacher
The teacher gives the general steps and videos of the classroom and the teacher will give
assignments. The experimental process is completed by the students and presented with an
assignment report. It can reasonably design questions about
Exploratory teaching method . Exploratory teaching method is conducted to cultivate the
communication, collaboration, critical thinking and theoretical knowledge and case
applications and provide references and learning materials, inspiring these students to think
and organize them to discuss.

Student
The content of it may be overlapping with that of others, but it also has its own discipline
characteristics and is constantly developing new theories and methods. Therefore, the teaching
of python data analysis course during period should choose appropriate teaching contents and
optimize them, so as to let the students understand the basic concept of python, python data-
visualization learning model and common learning modules, and let them can use the key
technology of python data analysis to analyze practical problems and understand the current
development of python.

Admin:
Admin will give authority to students and teachers . In order to facilitate
activate the students and activate the students. admin can see the score of all student marks and
performance. Admin can visualize the data of students and can
monitor students' solutions and their lacking knowledge in particular week.

40
Python and data-analysis:
Python is an increasingly popular tool for data analysis. In recent years, a number of libraries
have reached maturity, allowing R and Stata users to take advantage of the beauty, flexibility,
and performance of Python without sacrificing the functionality these older programs have
accumulated over the years.python focus on simplicity and readability, python it boasts a
gradual and relatively low learning curve. This ease of learning makes an ideal tool for
beginning programmers. Python offers programmers the advantage of using fewer lines of code
to accomplish tasks than one needs when using older languages.

41
CHAPTER-6
RESULTS

6.1 Home Page

6.2 Teacher login:

42
6.3 Teacher Home

6.4 student login:

43
6.5 Student home:

6.6 Student Assignment:

44
6.7 Student Marks:

6.8 Admin Login:

45
CHAPTER-7
SYSTEM TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality
of components, sub assemblies, assemblies and/or a finished product It is the process of
exercising software with the intent of ensuring that the Software system meets its requirements
and user expectations and does not fail in an unacceptable manner. There are various types of
test. Each test type addresses a specific testing requirement.

TYPES OF TESTS
7.1 Unit testing
Unit testing involves the design of test cases that validate that the internal
program logic is functioning properly, and that program inputs produce valid outputs. All
decision branches and internal code flow should be validated. It is the testing of individual
software units of the application .it is done after the completion of an individual unit before
integration. This is a structural testing, that relies on knowledge of its construction and is
invasive. Unit tests perform basic tests at component level and test a specific business process,
application, and/or system configuration. Unit tests ensure that each unique path of a business
process performs accurately to the documented specifications and contains clearly defined
inputs and expected results.

7.2 Integration testing


Integration tests are designed to test integrated software components to
determine if they actually run as one program. Testing is event driven and is more concerned
with the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically aimed
at exposing the problems that arise from the combination of components.

46
Functional test
Functional tests provide systematic demonstrations that functions tested are
available as specified by the business and technical requirements, system documentation, and
user manuals.
Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Input : identified classes of invalid input must be rejected.

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised.

Systems/Procedures : interfacing systems or procedures must be invoked.

Organization and preparation of functional tests is focused on requirements, key


functions, or special test cases. In addition, systematic coverage pertaining to identify Business
process flows; data fields, predefined processes, and successive processes must be considered
for testing. Before functional testing is complete, additional tests are identified and the effective
value of current tests is determined.

System Test
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An example of
system testing is the configuration oriented system integration test. System testing is based on
process descriptions and flows, emphasizing pre-driven process links and integration points.

7.3 White Box Testing


White Box Testing is a testing in which in which the software tester has
knowledge of the inner workings, structure and language of the software, or at least its purpose.
It is purpose. It is used to test areas that cannot be reached from a black box level.

47
7.4 Black Box Testing
Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most other kinds
of tests, must be written from a definitive source document, such as specification or
requirements document, such as specification or requirements document. It is a testing in which
the software under test is treated, as a black box .you cannot “see” into it. The test provides
inputs and responds to outputs without considering how the software works.
Unit Testing

Unit testing is usually conducted as part of a combined code and unit test phase
of the software lifecycle, although it is not uncommon for coding and unit testing to be
conducted as two distinct phases.

Test strategy and approach

Field testing will be performed manually and functional tests will be written
in detail.
Test objectives
• All field entries must work properly.
• Pages must be activated from the identified link.
• The entry screen, messages and responses must not be delayed.

Features to be tested
• Verify that the entries are of the correct format
• No duplicate entries should be allowed
• All links should take the user to the correct page.
Integration Testing
Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by interface
defects.

The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level
– interact without error.

Test Results: All the test cases mentioned above passed successfully. No defects encountered.

48
7.5 Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant participation
by the end user. It also ensures that the system meets the functional requirements.

Test Results: All the test cases mentioned above passed successfully. No defects encountered.

49
School-Enterprise Cooperation on Python Data Analysis Teaching

S.no Test Case Excepted Result Remarks(IF


Result Fails)

1. Teacher login If the teacher's Pass If the


name and teacher's
password is name or
correct then it password is
will be a valid not correct.
page.

2. Student If a data Pass If a data


Registration student is student is not
registered registered.
successfully.

4. Student login the student Pass If the student


name and name or
password is password is
correct then wrong.
getting a valid
page.

5. View student Student Pass If a student


registration is not
details registered .
available.

6. Teacher upload Video available Pass Video willn’t


to students be available
to students.

50
The classroom
video and assign
the assignment

7. Student will Student will Pass If video file is


open get the video not submitted
video.
The video

8. Student submit Student will Pass If a student


assignment write assignment
file is not
The submitted,
assignment and
submit and it
will display to
teacher

51
CHAPTER-8

CONCLUSION&FUTURE IMPROVEMENT
8.1 CONCLUSION
In this paper, we showed our exploration and reform on the school-
enterprise course Python Data Analysis. We analyzed the requirement of
enterprises and determined the teaching content accordingly. The teaching
content was further organized around the cases designed from simple to deep. To
cultivate creativity and scientific exploratory ability, student centered teaching
was performed. Students learned by trial, exploratory and verification of cases.
The benefit of case based exploratory teaching of data analysis using Python is
that students will focus on how to use computational thinking.in practical data
analysis rather than be overwhelmed by the details of theory and programming.

8.2 FUTURE ENHANCEMENT


The teaching content was further organized around the cases designed from
simple to deep. To cultivate creativity and scientific exploratory ability, student
centered teaching was performed. Students learned by trial, exploratory and
verification of cases. The benefit of case based exploratory teaching of data
analysis using Python is that students will focus on how to use computational
thinking in practical data analysis rather than be overwhelmed by the details of
theory and programming.

52
CHAPTER-9
BIBLOGRAPHY

[1] Introduction to computer science and programming using python.


https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x5#!

[2] Introduction to computational thinking and data science.


https://www.edx.org/course/introduction-computational-thinking-datamitx-6-
00-2x-2.
[3] Play with data in python.
https://www.icourse163.org/course/nju1001571005.

[4] Python data analysis and presentation.


https://www.icourse163.org/course/bit-1001870002.

[5] Shuaiguo Wang. Smart teaching tools in the context of mobile internet and
big data. Modern Educational Technology, 5:26–32, 2017.

53
CHAPTER-10
APPENDICES
Source Code
url.py:
path('admin/', admin.site.urls),
path('hello/',teacher.hello),
#path('home/',teacher.home,name='home'),
path('index/',school.index,name='index'),
path('admin1/',school.adminlogin,name='admin1'),
path('adminloginentered/',school.adminloginentered,name='adminloginentered'),
path('activatestudent/',student.activatestudent,name='activatestudent'),
#path('activateteacher/',teacher.activateteacher,name='activateteacher'),
path('logout/',school.logout,name='logout'),
path('teacher/',teacher.teacherlogin,name='teacher'),
path('teacherpage/',teacher.teacherpage,name='teacherpage'),
path('tchrregister/',teacher.tchrregister,name='tchrregister'),
path('teacherlogincheck/',teacher.teacherlogincheck,name='teacherlogincheck'),
path('teacherclass/',teacher.teacherclass,name='teacherclass'),
path('tweek1/',teacher.tweek1,name='tweek1'),
path('tweek2/',teacher.tweek2,name='tweek2'),
path('tweek3/',teacher.tweek3,name='tweek3'),
path('tweek4/',teacher.tweek4,name='tweek4'),
path('tweek5/',teacher.tweek5,name='tweek5'),
path('tweek6/',teacher.tweek6,name='tweek6'),
path('tweek7/',teacher.tweek7,name='tweek7'),
path('tweek8/',teacher.tweek8,name='tweek8'),
path('tweek9/',teacher.tweek9,name='tweek9'),
path('tweek10/',teacher.tweek10,name='tweek10'),
path('tweek11/',teacher.tweek11,name='tweek11'),
path('tweek12/',teacher.tweek12,name='tweek12'),

54
path('tweek2class1/',teacher.tweek2class1,name='tweek2class1'),
path('tweek3class1/',teacher.tweek3class1,name='tweek3class1'),
path('tweek4class1/',teacher.tweek4class1,name='tweek4class1'),
path('tweek5class1/',teacher.tweek5class1,name='tweek5class1'),
path('tweek6class1/',teacher.tweek6class1,name='tweek6class1'),
path('tweek7class1/',teacher.tweek7class1,name='tweek7class1'),
path('tweek8class1/',teacher.tweek8class1,name='tweek8class1'),
path('tweek9class1/',teacher.tweek9class1,name='tweek9class1'),
path('tweek10class1/',teacher.tweek10class1,name='tweek10class1'),
path('tweek11class1/',teacher.tweek11class1,name='tweek11class1'),
path('tweek12class1/',teacher.tweek12class1,name='tweek12class1'),
path('class1/',teacher.class1,name='class1'),
path('tclass2week2/',teacher.tclass2week2,name='tclass2week2'),
path('tweek2class/',teacher.tweek2class,name='tweek2class'),
path('tweek3class2/',teacher.tweek3class2,name='tweek3class2'),
path('tweek4class2/',teacher.tweek4class2,name='tweek4class2'),
path('tweek5class2/',teacher.tweek5class2,name='tweek5class2'),
path('tweek6class2/',teacher.tweek6class2,name='tweek6class2'),
path('tweek7class2/',teacher.tweek7class2,name='tweek7class2'),
path('tweek8class2/',teacher.tweek8class2,name='tweek8class2'),
path('tweek9class2/',teacher.tweek9class2,name='tweek9class2'),
path('tweek10class2/',teacher.tweek10class2,name='tweek10class2'),
path('tweek11class2/',teacher.tweek11class2,name='tweek11class2'),
path('tweek12class2/',teacher.tweek12class2,name='tweek12class2'),
path('studentsolutions/',teacher.studentsolutions,name='studentsolutions'),
path('finalscore/',teacher.finalscore,name='finalscore'),

55
views.py:
def studentdetails(request):
s=student.objects.all()
# print(s.email)
return render(request,'admin/studentdetails.html',{"qs":s})
def activatestudent(request):
if request.method =='GET':
uname=request.GET.get('pid')
print(uname)
status='Activated'
print("pid=",uname,"status=",status)
student.objects.filter(id=uname).update(status=status)
qs=student.objects.all()
return render(request,"admin/studentdetails.html",{"qs":qs})
def studentclass(request):
return render(request,'student/studentclass.html')
def week(request):
return render(request,'student/week1.html')
def week2(request):
return render(request,'student/sweek2.html')

56
models.py:
from django.db import models
# Create your models here.
class student(models.Model):
name = models.CharField(max_length=50)
email = models.EmailField()
passwd = models.CharField(max_length=40)
cwpasswd = models.CharField(max_length=40)
mobileno = models.CharField(max_length=50, default="", editable=True)
status = models.CharField(max_length=40, default="", editable=True)
def __str__(self):
return self.email
class Meta:
db_table='studentregister'

class userssolution1(models.Model):
week = models.CharField(max_length=100,default="", editable=True)
email = models.CharField(max_length=100,default="", editable=True)
task = models.CharField(max_length=100)
solution = models.CharField(max_length=50)
def __str__(self):
return self.email
class Meta:
db_table='userssolution1'

57
forms.py:
from student.models import *
from django.core import validators
class studentForm(forms.ModelForm):
name = forms.CharField(widget=forms.TextInput(), required=True, max_length=100,)
passwd = forms.CharField(widget=forms.PasswordInput(), required=True,
max_length=100)
cwpasswd = forms.CharField(widget=forms.PasswordInput(), required=True,
max_length=100)
email = forms.CharField(widget=forms.TextInput(),required=True)
mobileno= forms.CharField(widget=forms.TextInput(), required=True,
max_length=10,validators=[validators.MaxLengthValidator(10),validators.MinLengthValidat
or(10)])
status = forms.CharField(widget=forms.HiddenInput(), initial='waiting', max_length=100)
def __str__(self):
return self.email
class Meta:
model=student
fields=['name','passwd','cwpasswd','email','mobileno','status']
class userssolution1Form(forms.ModelForm):
week =
forms.ChoiceField(choices=[('week1','week1'),('week2','week2'),('week3','week3'),('week4','w
eek4'),('week5','week5'),('week6','week6'),('week7','week7'),('week8','week8'),('week9','week9'
),('week10','week10'),('week11','week11'),('week12','week12')])
email = forms.CharField(widget=forms.TextInput(), required=True)
task = forms.CharField(widget=forms.TextInput(), required=True, max_length=100,)
solution = forms.CharField(widget=forms.Textarea(), required=True, max_length=100)
class Meta:
model = userssolution1
fields = ['week','email','task', 'solution']

58
Students.html:
{%extends 'adminbase.html'%}
{%load static%}
{%block contents%}
<div class="wrapper col2">
<div id="featured_slide">
<div class="featured_box">
<h2></h2>
<table border="2px solid red" align="left">
<tr><th style="color:green">Id</th>
<th style="color:green">name</th>
<th style="color:green">email</th>
<th style="color:green">mobileno</th>
<th style="color:green">status</th>
<th style="color:green">activate</th>
</tr>

{% for x in qs %}
<tr>
<td style="color:red">{{x.id}}</td>
<td style="color:red">{{x.name}}</td>
<td style="color:red">{{x.email}}</td>
<td style="color:red">{{x.mobileno}}</td>
<td style="color:red">{{x.status}}</td>

{% if x.status == 'waiting' %}
<td style="color:orange"> <a href="/activatestudent/?pid={{ x.id }}"
>Activate</a></td>
{% else %}

59
<td style="color:orange"> Activated</td>
{% endif %}

</tr>
{% endfor %}

</table>
</p>
<div class="floater">
<h2></h2>
<p></p>

</div>
</div>

</div>
</div>
{%endblock%}

60

You might also like