db.sqlite3 filled with isotopes
This commit is contained in:
0
isotables/isotopapp/__init__.py
Normal file
0
isotables/isotopapp/__init__.py
Normal file
3
isotables/isotopapp/admin.py
Normal file
3
isotables/isotopapp/admin.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
6
isotables/isotopapp/apps.py
Normal file
6
isotables/isotopapp/apps.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class IsotopappConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'isotopapp'
|
13
isotables/isotopapp/models.py
Normal file
13
isotables/isotopapp/models.py
Normal file
@ -0,0 +1,13 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
class Isotope(models.Model):
|
||||
n_protons = models.IntegerField()
|
||||
n_nucleons = models.IntegerField()
|
||||
stable = models.BooleanField()
|
||||
symbol = models.CharField(max_length=2)
|
||||
name = models.CharField(max_length=255)
|
||||
spin_quantum_number = models.FloatField()
|
||||
gamma = models.FloatField() # MHz/T
|
||||
natural_abundance = models.FloatField()
|
||||
quadrupole_moment = models.FloatField(null=True)
|
26
isotables/isotopapp/templates/home.html
Normal file
26
isotables/isotopapp/templates/home.html
Normal file
@ -0,0 +1,26 @@
|
||||
<div class="center">
|
||||
<h1>Basic Calculator</h1>
|
||||
|
||||
<form action="result">
|
||||
<input type="number" name="number1" placeholder="Enter first number">
|
||||
<br>
|
||||
<br>
|
||||
<input type="number" name="number2" placeholder="Enter second number">
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit" name="add">Add</button>
|
||||
<button type="submit" name="subtract">Subtract</button>
|
||||
<button type="submit" name="multiply">Multiply</button>
|
||||
<button type="submit" name="divide">Divide</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.center {
|
||||
margin: auto;
|
||||
width: 60%;
|
||||
border: 3px solid #a5addb;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
15
isotables/isotopapp/templates/result.html
Normal file
15
isotables/isotopapp/templates/result.html
Normal file
@ -0,0 +1,15 @@
|
||||
<div class="center">
|
||||
The result is:
|
||||
<h1>{{ans}}</h1>
|
||||
|
||||
<a href="{% url 'home' %}">Go Back</a>
|
||||
</div>
|
||||
<style>
|
||||
.center {
|
||||
margin: auto;
|
||||
width: 60%;
|
||||
border: 3px solid #a5addb;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
3
isotables/isotopapp/tests.py
Normal file
3
isotables/isotopapp/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
8
isotables/isotopapp/urls.py
Normal file
8
isotables/isotopapp/urls.py
Normal file
@ -0,0 +1,8 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
urlpatterns = [
|
||||
path('', views.home, name='home'),
|
||||
path('result/', views.result, name='result'),
|
||||
]
|
||||
|
||||
|
25
isotables/isotopapp/views.py
Normal file
25
isotables/isotopapp/views.py
Normal file
@ -0,0 +1,25 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def home(request):
|
||||
return render(request, 'home.html')
|
||||
|
||||
def result(request):
|
||||
num1 = int(request.GET.get('number1'))
|
||||
num2 = int(request.GET.get('number2'))
|
||||
|
||||
|
||||
if request.GET.get('add') == "":
|
||||
ans = num1 + num2
|
||||
|
||||
elif request.GET.get('subtract') == "":
|
||||
ans = num1 - num2
|
||||
|
||||
elif request.GET.get('multiply') == "":
|
||||
ans = num1 * num2
|
||||
|
||||
else:
|
||||
ans = num1 / num2
|
||||
|
||||
return render(request, 'result.html', {'ans': ans})
|
Reference in New Issue
Block a user