Commit 5e7396fe authored by phatiphan.th.63's avatar phatiphan.th.63

project

parent bbe1069a
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Post(models.Model):
# id
title = models.CharField(max_length=300)
news = models.TextField()
image = models.ImageField(upload_to='posts')
date = models.DateField(auto_now_add=True)
def __str__(self):
return self.title
\ No newline at end of file
......@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Todo list</title>
<title>POS FOOD</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
......
<nav class="bg-white border-gray-200 dark:bg-gray-700">
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl px-4 md:px-6 py-2.5">
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white">Food Shop</span>
<div class="flex items-center">
{% if user.is_authenticated %}
<span class="text-white m-l-5">Welcome {{ user.username }}</span>
<a href="/logout" class="text-sm m-5 font-medium text-blue-600 dark:text-blue-500 hover:underline">Logout</a>
{% else %}
<a href="/login" class="text-sm m-5 font-medium text-blue-600 dark:text-blue-500 hover:underline">Login</a>
<a href="/register" class="text-sm font-medium text-blue-600 dark:text-blue-500 hover:underline">Register</a>
{% endif %}
</div>
</div>
</nav>
<nav class="bg-gray-50 dark:bg-gray-200">
<div class="py-3 px-4 mx-auto max-w-screen-xl md:px-6">
<div class="flex items-center">
<ul class="flex flex-row mt-0 mr-6 space-x-8 text-sm font-medium">
<li>
<a href="/sciweb/main" class="text-gray-900 dark:text-black hover:underline" aria-current="page">หน้าหลัก</a>
</li>
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline">อาหารแนะนำ</a>
</li>
<li>
<a href="/sciweb/contact" class="text-gray-900 dark:text-black hover:underline">ติดต่อเรา</a>
</li>
</ul>
</div>
</div>
</nav>
\ No newline at end of file
{% extends 'index.html' %}
{% block main %}
<h1>ระบบกำลังปรับปรุงจะกลับมาเร็วๆนี้
</h1>
{% endblock %}
\ No newline at end of file
......@@ -19,13 +19,13 @@
<div class="flex items-center">
<ul class="flex flex-row mt-0 mr-6 space-x-8 text-sm font-medium">
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline" aria-current="page">หน้าหลัก</a>
<a href="/index" class="text-gray-900 dark:text-black hover:underline" aria-current="page">หน้าหลัก</a>
</li>
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline">อาหารแนะนำ</a>
</li>
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline">ติดต่อเรา</a>
<a href="/contact" class="text-gray-900 dark:text-black hover:underline">ติดต่อเรา</a>
</li>
</ul>
</div>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Univ Web Project Login</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<!-- component -->
<section class="bg-gray-50 dark:bg-white">
<div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
<div class="w-full bg-white rounded-lg shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-white-800 dark:border-gray-700">
<div class="p-6 space-y-4 md:space-y-6 sm:p-8">
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-black">
Sign in to your account
</h1>
<form method="post" class="space-y-4 md:space-y-6" action="/login">
{% csrf_token %}
<div>
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-black">Username</label>
<input type="text" name="username" id="username" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-200 dark:border-gray-600 dark:placeholder-gray-400 dark:text-black dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Username">
</div>
<div>
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-black">Password</label>
<input type="password" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-black-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-200 dark:border-gray-600 dark:placeholder-gray-400 dark:text-black dark:focus:ring-blue-500 dark:focus:border-blue-500">
</div>
<a href="#" class="text-sm font-medium text-primary-600 hover:underline dark:text-primary-500">Forgot password?</a>
</div>
<div class="flex items-center justify-center">
<button type="submit" class="shadow-xl text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Login</button>
<button class="shadow-xl text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800"><a href="/index">Home</a></button>
</div>
</form>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file
<nav class="bg-white border-gray-200 dark:bg-gray-700">
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl px-4 md:px-6 py-2.5">
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white">Food Shop</span>
<div class="flex items-center">
{% if user.is_authenticated %}
<span class="text-white m-l-5">Welcome {{ user.username }}</span>
<a href="/logout" class="text-sm m-5 font-medium text-blue-600 dark:text-blue-500 hover:underline">Logout</a>
{% else %}
<a href="/login" class="text-sm m-5 font-medium text-blue-600 dark:text-blue-500 hover:underline">Login</a>
<a href="/register" class="text-sm font-medium text-blue-600 dark:text-blue-500 hover:underline">Register</a>
{% endif %}
</div>
</div>
</nav>
<nav class="bg-gray-50 dark:bg-gray-200">
<div class="py-3 px-4 mx-auto max-w-screen-xl md:px-6">
<div class="flex items-center">
<ul class="flex flex-row mt-0 mr-6 space-x-8 text-sm font-medium">
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline" aria-current="page">หน้าหลัก</a>
</li>
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline">อาหารแนะนำ</a>
</li>
<li>
<a href="/" class="text-gray-900 dark:text-black hover:underline">ติดต่อเรา</a>
</li>
</ul>
</div>
</div>
</nav>
\ No newline at end of file
from django.urls import path
from . import views
from django.shortcuts import render
from myapp.models import Post
urlpatterns = [
path("index",views.index,name='index'),
path("nav",views.index,name='nav')
path("index",views.index),
path("login",views.login),
path('contact', views.contact),
]
......@@ -4,5 +4,8 @@ from django.shortcuts import render
def index(req):
return render(req,'index.html')
def nav(req):
return render(req,'navbar.html')
\ No newline at end of file
def contact(req):
return render(req,'contact.html')
def login(req):
return render(req,'login.html')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment