db.sqlite3 filled with isotopes

This commit is contained in:
2025-03-20 22:05:44 +01:00
parent b849274618
commit 0d55853f03
24 changed files with 381 additions and 0 deletions

View File

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class IsotopappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'isotopapp'

View 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)

View 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>

View 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>

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View 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'),
]

View 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})