Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,30 @@ Write your own steps

## PROGRAM

Include your code here
''''
admin.py

## OUTPUT
from django.contrib import admin
from .models import Employee,EmployeeAdmin
admin.site.register(Employee,EmployeeAdmin)

modles.py

from django.db import models
from django.contrib import admin
class Employee (models.Model):
eid=models.CharField(max_length=20,help_text="Employee")
name=models.CharField(max_length=100)
salary=models.IntegerField()
age=models.IntegerField()
email=models.EmailField()

Include the screenshot of your admin page.
class EmployeeAdmin(admin.ModelAdmin):
list_display=('eid','name','salary','age','email')
''''

## OUTPUT
![Alt text](<Screenshot from 2023-12-11 20-37-15.png>)


## RESULT
Binary file added Screenshot from 2023-12-11 20-37-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions dataproject/dataproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from pathlib import Path

import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand All @@ -36,7 +36,7 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.staticfiles','myapp'
]

MIDDLEWARE = [
Expand Down
Binary file added dataproject/db.sqlite3
Binary file not shown.
Empty file added dataproject/myapp/__init__.py
Empty file.
Binary file not shown.
Binary file added dataproject/myapp/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file added dataproject/myapp/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions dataproject/myapp/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin
from .models import Employee,EmployeeAdmin
admin.site.register(Employee,EmployeeAdmin)
6 changes: 6 additions & 0 deletions dataproject/myapp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class MyappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'myapp'
25 changes: 25 additions & 0 deletions dataproject/myapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.5 on 2023-12-11 14:57

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Employee',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('eid', models.CharField(help_text='Employee', max_length=20)),
('name', models.CharField(max_length=100)),
('salary', models.IntegerField()),
('age', models.IntegerField()),
('email', models.EmailField(max_length=254)),
],
),
]
Empty file.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions dataproject/myapp/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.db import models
from django.contrib import admin
class Employee (models.Model):
eid=models.CharField(max_length=20,help_text="Employee")
name=models.CharField(max_length=100)
salary=models.IntegerField()
age=models.IntegerField()
email=models.EmailField()

class EmployeeAdmin(admin.ModelAdmin):
list_display=('eid','name','salary','age','email')
3 changes: 3 additions & 0 deletions dataproject/myapp/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions dataproject/myapp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.