This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import BaseHTTPRequestHandler, HTTPServer | |
class SimpleHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header('Content-type', 'text/plain') | |
self.end_headers() | |
self.wfile.write(b"Hello, World!") | |
server = HTTPServer(('localhost', 8080), SimpleHandler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uvicorn | |
from fastapi import FastAPI, HTTPException | |
from pydantic import BaseModel | |
app = FastAPI() | |
class Item(BaseModel): | |
name: str | |
price: float |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .models import ChartRequest | |
from django.forms import ModelForm, TextInput | |
class ChartRequestForm(ModelForm): | |
class Meta: | |
model = ChartRequest | |
fields = ["begin_day", "end_day", "json"] | |
widgets = { | |
"begin_day": TextInput(attrs={ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
from django.contrib.auth.forms import AuthenticationForm | |
from django.contrib.auth.models import User | |
from .models import Deal | |
class AuthUserForm(AuthenticationForm, forms.ModelForm): | |
class Meta: | |
model = User |