Skip to content

Commit 55813a5

Browse files
committed
REST API created
1 parent 4bc6468 commit 55813a5

24 files changed

+450
-1
lines changed

Pipfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
8+
[packages]
9+
django = "==3.0.6"
10+
djangorestframework = "*"
11+
12+
[requires]
13+
python_version = "3.7"

Pipfile.lock

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
# RESTAPI
1+
# RESTAPI
2+
3+
DjangoRestFramework has beautiful view to create RestFull API.
4+
5+
This Is a sample REST API For School Student Information.
6+
7+
![Sample Picture for REST API](Sample_Picture/samplepicture1.png)
8+
9+
![Sample Picture for REST API](Sample_Picture/samplepicture2.png)

Sample_Picture/samplepicture1.png

18.5 KB
Loading

Sample_Picture/samplepicture2.png

58.4 KB
Loading

api/__init__.py

Whitespace-only changes.

api/admin.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from django.contrib import admin
2+
from .models import Student,School
3+
4+
class StudentAdmin(admin.ModelAdmin):
5+
fieldsets = (
6+
('Student Field', {
7+
'fields': ('student_name', 'student_class', 'Student_roll_no')
8+
}),
9+
('Other Field', {
10+
'fields': ('student_registration_no','student_subject','student_school_name'),
11+
}),
12+
)
13+
14+
class SchoolAdmin(admin.ModelAdmin):
15+
fieldsets = (
16+
('List Of Schools', {
17+
'fields': ['schools_list']
18+
}),
19+
)
20+
21+
admin.site.register(School, SchoolAdmin)
22+
admin.site.register(Student, StudentAdmin)
23+

api/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ApiConfig(AppConfig):
5+
name = 'api'

api/migrations/0001_initial.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 3.0.6 on 2020-05-21 06:59
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
initial = True
9+
10+
dependencies = [
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='Student',
16+
fields=[
17+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18+
('student_name', models.CharField(max_length=150)),
19+
('student_class', models.CharField(max_length=20)),
20+
('Student_roll_no', models.IntegerField()),
21+
('student_subject', models.TextField()),
22+
],
23+
),
24+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 3.0.6 on 2020-05-21 12:07
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('api', '0001_initial'),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='School',
16+
fields=[
17+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18+
('schools', models.CharField(max_length=150)),
19+
],
20+
),
21+
migrations.AddField(
22+
model_name='student',
23+
name='school_name',
24+
field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='api.School'),
25+
),
26+
]

0 commit comments

Comments
 (0)