mirror of
https://github.com/KevinMidboe/Node-Com-Handler.git
synced 2026-07-24 10:32:07 +00:00
Folder that holds database for future plans of all contentes of Plex
Library and system info.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import Address
|
||||
|
||||
admin.site.register(Address)
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PlexConfig(AppConfig):
|
||||
name = 'plex'
|
||||
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.3 on 2016-11-23 20:16
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Address',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ip_address', models.CharField(max_length=200)),
|
||||
('first_connect', models.DateTimeField(verbose_name='date first accessed on address')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Location',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ip_version', models.CharField(max_length=1)),
|
||||
('country', models.CharField(max_length=100)),
|
||||
('city', models.CharField(max_length=100)),
|
||||
('region', models.CharField(max_length=100)),
|
||||
('postal_code', models.IntegerField(max_length=6)),
|
||||
('address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plex.Address')),
|
||||
],
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from django.db import models
|
||||
|
||||
import datetime
|
||||
from django.utils import timezone
|
||||
# Create your models here.
|
||||
class Address(models.Model):
|
||||
ip_address = models.CharField(max_length=200)
|
||||
first_connect = models.DateTimeField('date first accessed on address')
|
||||
|
||||
def created_recently(self):
|
||||
return self.first_connect >= timezone.now() - datetime.timedelta(days=1)
|
||||
|
||||
def __str__(self):
|
||||
return self.ip_address
|
||||
|
||||
class Location(models.Model):
|
||||
address = models.ForeignKey(Address, on_delete=models.CASCADE)
|
||||
ip_version = models.IntegerField(default=4)
|
||||
country = models.CharField(max_length=100)
|
||||
city = models.CharField(max_length=100)
|
||||
region = models.CharField(max_length=100)
|
||||
postal_code = models.IntegerField(default=0)
|
||||
|
||||
def __str__(self):
|
||||
return str([self.country, self.city, self.region])
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Author: KevinMidboe
|
||||
# @Date: 2016-11-23 20:43:37
|
||||
# @Last Modified by: KevinMidboe
|
||||
# @Last Modified time: 2016-11-23 20:43:50
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.index, name='index'),
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
from django.http import HttpResponse
|
||||
|
||||
def index(request):
|
||||
return HttpResponse("Hello, world. You're at the plex index.")
|
||||
Reference in New Issue
Block a user