예제 #1
0
from django.conf.urls import url

from . import views
from jchart.views import ChartView
from views import graficaTemperatura, graficaHumedad

grafica_temp = graficaTemperatura()
grafica_hum = graficaHumedad()

urlpatterns = [
    #ejemplo: /home/
    url(r'^$', views.index, name='index'),
    url(r'^(?P<muestreo_id>[0-9]+)/$', views.detalleMuestreo, name='detalle'),
    url(r'^actuadores/$', views.manejoActuadores, name='actuadores'),
    url(r'^graficos/$', views.manejoGraficos, name='graficos'),
    url(r'^charts/line_temperatura/$',
        ChartView.from_chart(grafica_temp),
        name='plot_temperaturas'),
    url(r'^charts/line_humedad/$',
        ChartView.from_chart(grafica_hum),
        name='plot_humedad'),
]
예제 #2
0
from django.conf.urls import include, url
from django.contrib import admin

from demo import views
from demo import charts
from jchart.views import ChartView

admin.autodiscover()

urlpatterns = [
    url(r'^$', views.home, name='home'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^charts/scatter_line_chart/$',
        ChartView.from_chart(charts.ScatterLineChart()),
        name='scatter_line_chart'),
    url(r'^charts/time_series_chart/$',
        ChartView.from_chart(charts.TimeSeriesChart()),
        name='time_series_chart'),
    url(r'^charts/bar_chart/$',
        ChartView.from_chart(charts.BarChart()),
        name='bar_chart'),
    url(r'^charts/radar_chart/$',
        ChartView.from_chart(charts.RadarChart()),
        name='radar_chart'),
    url(r'^charts/polar_chart/$',
        ChartView.from_chart(charts.PolarChart()),
        name='polar_chart'),
    url(r'^charts/pie_chart/$',
        ChartView.from_chart(charts.PieChart()),
        name='pie_chart'),
    url(r'^charts/bubble_chart/$',
예제 #3
0
from courses import views

from django.conf.urls import url

from jchart.views import ChartView

from courses.models import MarkDistributionHistogram

app_name = 'courses'

urlpatterns = [
    url(r'^$', views.CourseStudentList.as_view(), name='list'),
    url(r'^create/$', views.CourseStudentCreate.as_view(), name='create'),
    url(r'^add/(?P<user_id>[0-9]+)/$', views.add_course_student, name='add'),
    url(r'^ranks/$', views.RankList.as_view(), name='ranks'),
    url(r'^marks/$', views.mark_calculations, name='my_marks'),
    url(r'^marks/(?P<user_id>[0-9]+)/$', views.mark_calculations, name='marks'),
    url(r'^close_semester/$', views.end_active_semester, name='end_active_semester'),
    url(r'^ajax/progress_chart/(?P<user_id>[0-9]+)/$', views.ajax_progress_chart, name='ajax_progress_chart'),

    url(r'^charts/bar_chart/(?P<user_id>[0-9]+)/$', ChartView.from_chart(MarkDistributionHistogram()),
        name='mark_distribution_chart'),
    # url(r'^semester/$', views.semesters, name='semester'),
    # url(r'^semester/$', views.semesters, name='semester'),
    # url(r'^create2/$', views.course_student_create, name='create2'),
    # url(r'^(?P<pk>[0-9]+)/$', views.Detail.as_view(), name='detail'),
    # url(r'^(?P<pk>[0-9]+)/edit/$', views.Update.as_view(), name='update'),
]
예제 #4
0
from django.urls import path
from django.urls import include
from django.conf.urls import url
from . import charts
from . import views
from jchart.views import ChartView

urlpatterns = [
    path('', views.index, name='index'),
    url(r'^charts/scatter_line_chart/$',
        ChartView.from_chart(charts.ScatterLineChart()),
        name='scatter_line_chart')
]
예제 #5
0
from courses import views
from courses.models import MarkDistributionHistogram

app_name = 'courses'

urlpatterns = [
    url(r'^$', views.CourseStudentList.as_view(), name='list'),
    url(r'^create/$', views.CourseStudentCreate.as_view(), name='create'),
    url(r'^add/(?P<user_id>[0-9]+)/$', views.add_course_student, name='add'),
    url(r'^ranks/$', views.RankList.as_view(), name='ranks'),
    # DISABLE MARKS
    url(r'^marks/$', views.mark_calculations, name='my_marks'),
    url(r'^marks/(?P<user_id>[0-9]+)/$', views.mark_calculations,
        name='marks'),
    url(r'^close_semester/$',
        views.end_active_semester,
        name='end_active_semester'),
    url(r'^ajax/progress_chart/(?P<user_id>[0-9]+)/$',
        views.ajax_progress_chart,
        name='ajax_progress_chart'),
    url(r'^charts/bar_chart/(?P<user_id>[0-9]+)/$',
        ChartView.from_chart(MarkDistributionHistogram()),
        name='mark_distribution_chart'),
    # url(r'^semester/$', views.semesters, name='semester'),
    # url(r'^semester/$', views.semesters, name='semester'),
    # url(r'^create2/$', views.course_student_create, name='create2'),
    # url(r'^(?P<pk>[0-9]+)/$', views.Detail.as_view(), name='detail'),
    # url(r'^(?P<pk>[0-9]+)/edit/$', views.Update.as_view(), name='update'),
]
예제 #6
0
def index(request):
    hour = 21
    minute = 00
    interval = 0
    time_set = [{
        'hour': 21,
        'minute': 00
    }, {
        'hour': 21,
        'minute': 20
    }, {
        'hour': 21,
        'minute': 35
    }, {
        'hour': 22,
        'minute': 00
    }, {
        'hour': 22,
        'minute': 20
    }, {
        'hour': 22,
        'minute': 40
    }, {
        'hour': 23,
        'minute': 00
    }]
    prices = [
        PriceStatic(5.80, 9.20, 8.40, 15.80, 9.20, 16.00, 19.80, 0),
        PriceStatic(2.50, 9.00, 8.40, 10.00, 6.00, 10.00, 19.80, 1),
        PriceStatic(5.80, 6.00, 8.40, 10.00, 6.00, 16.00, 19.80, 2),
        PriceStatic(2.50, 6.00, 8.40, 15.80, 9.20, 16.00, 10.00, 3),
        PriceStatic(5.80, 9.20, 5.00, 10.00, 9.20, 10.00, 10.00, 4),
        PriceStatic(2.50, 9.20, 5.00, 10.00, 6.00, 16.00, 19.80, 5),
        PriceStatic(2.50, 6.00, 8.40, 15.80, 6.00, 10.00, 19.80, 6),
        PriceStatic(5.80, 9.20, 8.40, 15.80, 9.20, 10.00, 10.00, 7),
        PriceStatic(5.8, 6.00, 5.00, 10.00, 9.20, 16.00, 10.00, 8),
        PriceStatic(2.50, 9.20, 8.40, 10.00, 6.00, 16.00, 10.00, 9)
    ]
    arrows = [{
        'name':
        'Fosters (FRS)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }, {
        'name':
        'Tanqueray G&T (TGT)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }, {
        'name':
        'Captain Morgan Splash (CMS)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }, {
        'name':
        'Double Especial & Tropical Red Bull (DETR)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }, {
        'name':
        'Roe & Co + Ginger Ale (RCG)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }, {
        'name':
        'Double Jagerbomb (DJG)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }, {
        'name':
        'Double Vodka Redbull (VDKR)',
        'img':
        'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
    }]

    commentary = [
        Commentary(
            '\"No way I’m buying anything but Fosters at this price\" – Michael O’R. -Mechanical Engineering',
            '\"I refuse to drink any more gin unless it’s in one of those fancy glasses\"- Gio Radaelli',
            '\"No going to leave it a while and see if it drops\" – Mark T.',
            0),
        Commentary(
            '\"Not much of a Fosters fan but at €2.50 beggars can’t be choosers\" – Peter S. Marketing',
            '\"€10 for a double Especial? That’s bloody trouble\" Christian Casey',
            '\"The queues are far too long\" -Mark F', 1),
        Commentary(
            '\"No more spirits for me, I’ve got a 9am\" – Conor C.',
            '\"Vodka has made me the influencer I am today, I drank it before I scored the funniest try EVER\"- Rob Lipsett',
            '\"I rest my case; the boom is back\" – Michael R', 2),
        Commentary(
            '\n"Its expensive so this Double Vodka is the last one I’m going to get\" – Vanessa G.',
            '\"I can only drink shots\" – Becca S',
            '\"This night has been pivotal in the squads preparation for the world cup next year, massive thanks toDIT I&E society\" – Joe Schmidt',
            3),
        Commentary(
            '\"At this price it doesn’t make sense, I’ll be buying Captain Morgan\" – Laura D.',
            '\"The Queues have slowing down so I reckon it’ll fall heavily soon\" – Danny M.',
            '\"Can’t believe I got caught at the bar during the price change\" – Peter K. – Business & Management',
            4),
        Commentary(
            '\"Comparatively, Fosters is the best value on the market right now\" -Lucy K. – Business & Spanish',
            '\"I’m meant to be doing dry November\" -Ciara L.',
            '\"Yeah definitely loading up on Captain Morgans while it’s cheap\" – Lorcan M.',
            5),
        Commentary(
            '\"Man, Roe & Co gets you fairly buzzed.\" Roy Keane',
            '\"Everyone’s doing bombs and I don’t want to miss out\" – Sarah F.',
            '\n"Its expensive so this is the last one I’m going to get\" – Vanessa G.',
            6),
        Commentary(
            '\"Won’t be going near Fosters, be sticking with the Double Vodka RedBull’s now\" – Katie L. Engineering',
            '\"I’m more of a Whiskey man myself\" – Rob Kearney',
            '\"Not even sure what this Tropical stuff is but it’s good\"- Leo Varadkar',
            7),
        Commentary(
            '\"Roe and Co is good, but its not THAT good\" – Rachel O’R.',
            '\"I Love Vodka #Gymshark\"- Sian Walton',
            '\"I can’t fork that out for Jager\" – Peter D.', 8),
        Commentary(
            '\"Ah at this price you can’t beat a Double Especial Tropical\" – Michael R.',
            '\"I have too many shots, need to go back to the beer\" – Jamie R.',
            '\"Huge queues for Fosters leading to frantic buying\" – DIT SMF analyst',
            9)
    ]
    current_commentary = commentary[0]
    localtime = time.localtime(time.time())
    current_hour = localtime.tm_hour
    current_minute = localtime.tm_min
    current_time = time_set[interval]
    for curtime in time_set:
        if current_hour >= curtime['hour'] and current_minute > curtime[
                'minute']:
            interval = time_set.index(curtime)
            previous_prices = prices[interval - 1]
            current_prices = prices[interval]
            index = 0
            for statement in arrows:
                if previous_prices.list[index] < current_prices.list[index]:
                    statement[
                        'img'] = 'https://upload.wikimedia.org/wikipedia/commons/7/7f/Green_equilateral_triangle_point_up.svg'
                elif previous_prices.list[index] > current_prices.list[index]:
                    statement[
                        'img'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Red_Triangle.svg/1200px-Red_Triangle.svg.png'
                else:
                    statement = statement
                index = index + 1
    current_commentary = commentary[interval]

    ChartView.from_chart(charts.ScatterLineChart())
    return render(
        request, 'main/index.html', {
            'interval': interval,
            'prices': prices[interval],
            'arrows': arrows,
            'commentary': current_commentary
        })
예제 #7
0
from django.conf.urls import url
from jchart.views import ChartView
from . import views

app_name = 'progress'
urlpatterns = [
    url(r'reviewed/$', views.reviewed, name='reviewed'),
    url(r'learned/$', views.learned, name='learned'),
    #url(r'charts/review_chart/(?P<username>\w+)/$', ChartView.from_chart(views.review_chart), name='review_chart'),
    #url(r'charts/learned_chart/(?P<username>\w+)/$', ChartView.from_chart(views.learned_chart), name='learned_chart'),
    url(r'charts/review_chart/(?P<username>\w+)/(?P<delta>\w+)/$',
        ChartView.from_chart(views.review_chart),
        name='review_chart'),
    url(r'charts/learned_chart/(?P<username>\w+)/(?P<delta>\w+)/$',
        ChartView.from_chart(views.learned_chart),
        name='learned_chart'),
    url(r'', views.index, name='index'),
]
예제 #8
0
from django.urls import path
from products import views
from jchart.views import ChartView
from .views import LineChart, PieChart, Flipkart

# LineChart is a class inheriting from jchart.Chart
line_chart = LineChart()
pie_chart = PieChart()

urlpatterns = [
    path('', views.index, name='home'),
    path('charts/line_chart/',
         ChartView.from_chart(line_chart),
         name='line_chart'),
    path('charts/pie_chart/',
         ChartView.from_chart(pie_chart),
         name='pie_chart'),
]
예제 #9
0
from django.conf.urls import url
from . import views
from . import charts

from jchart.views import ChartView

urlpatterns = [
    url(r'^$', views.home, name='home'),
    url(r'^convert/(?P<amount>\d+(?:\.\d+)?)/(?P<target>\w+)/(?P<base>\w+)/(?P<convert_date>\d{4}-\d{2}-\d{2})/$',
        views.convert,
        name="convert"),
    url(r'^charts/time_series_chart/(?P<target>\w+)/$',
        ChartView.from_chart(charts.TimeSeriesChart()),
        name='time_series_chart'),
    url(
        r'^charts/time_series_chart/(?P<target>\w+)/(?P<start_date>\d{4}-\d{2}-\d{2})/$',
        ChartView.from_chart(charts.TimeSeriesChart())),
    url(
        r'^charts/time_series_chart/(?P<target>\w+)/(?P<base>\w+)/(?P<start_date>\d{4}-\d{2}-\d{2})/$',
        ChartView.from_chart(charts.TimeSeriesChart())),
    url(
        r'^charts/time_series_chart/(?P<target>\w+)/(?P<start_date>\d{4}-\d{2}-\d{2})/(?P<end_date>\d{4}-\d{2}-\d{2})/$',
        ChartView.from_chart(charts.TimeSeriesChart())),
    url(
        r'^charts/time_series_chart/(?P<target>\w+)/(?P<base>\w+)/(?P<start_date>\d{4}-\d{2}-\d{2})/(?P<end_date>\d{4}-\d{2}-\d{2})/$',
        ChartView.from_chart(charts.TimeSeriesChart())),
]