def page_charts(request): step_hit_count_by_page(request.path) logs = harvests_by_hour_of_day() logs_sexy = harvests_by_sex() logs_by_score = harvests_by_score() context = { "copy_year": datetime.now().year, "logs": logs, "logs_sexy": logs_sexy, "logs_sexy_hour": logs_by_score, 'release': get_version_json(), "title": "Harvest Charts", "blurb": get_page_blurb_override('deer_harvest_logbook/charts/'), } return render(request, "deer_harvest_logbook/harvest_charts.html", context)
def page_all_harvests_by_shooter_pk(request, shooter_pk=1): step_hit_count_by_page(request.path) perm_check = request.user.has_perm( 'deer_harvest_logbook.view_deermanagementpermit') unrestricted_user = perm_check all_news = all_harvests context = { "copy_year": datetime.now().year, "all_news": all_news, 'release': get_version_json(), "title": "Deer Harvest Logbook", "unrestricted_user": unrestricted_user, "blurb": get_page_blurb_override('deer_harvest_logbook/by_shooter/'), } return render(request, "deer_harvest_logbook/all_harvests.html", context)
def page_home(request): step_hit_count_by_page(request.path) # puppies_by_sex_all = puppies_by_sex() # puppies_by_sex_male = puppies_by_sex("Male") # puppies_by_sex_female = puppies_by_sex("Female") secrets = get_page_secret('puppy_fostering/') context = { "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Puppy Fostering", "secrets": secrets, "blurb": get_page_blurb_override('puppy_fostering/'), } return render(request, "puppy_fostering/home.html", context)
def page_charts_by_time(request): step_hit_count_by_page(request.path) context = { "graph_api_node": '/groundhog_logbook/api/chart/by_time/data/', "graph_header": "# of Groundhog Removals (By Time)", "graph_message": "We're only showing by the removals by the hour.", # "restart": get_restart_notice, "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Groundhog Line Charts", "blurb": get_page_blurb_override('groundhog_logbook/graphic_charts/'), } return render(request, "groundhog_logbook/groundhog_graphic_generic.html", context)
def page_charts_by_distance(request): step_hit_count_by_page(request.path) context = { "graph_api_node": '/groundhog_logbook/api/chart/by_distance/data/', "graph_header": "# of Groundhog Removals (By Distance)", "graph_message": "Rounded in 25 yard increments if under 400 yards.", # "restart": get_restart_notice, "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Groundhog Line Charts", "blurb": get_page_blurb_override('groundhog_logbook/graphic_charts/'), } return render(request, "groundhog_logbook/groundhog_graphic_generic.html", context)
def page_farm_invites_view(request): # all_invites = InviteListing.objects.all().order_by('Invite_Date', 'Invite_Secondary') this_moment = datetime.now() # only events not past, ordered by date, am then pm.. then secondary listings all_invites = InviteListing.objects.filter( Q(Show_Listing=True) & Q(Cancel_Code="InviteActive") & (Q(Invite_Date=this_moment.date()) | Q(Invite_Date__gt=this_moment.date()))).order_by( 'Invite_Date', 'Invite_Secondary', 'Desired_Time_Slot', ) context = { "restart": get_restart_notice, 'contact_good': 'COMPLETE', 'contact_okay': '85%', 'contact_poor': '66%', 'contact_bad': '5%', 'release': get_version_json(), "title": "Farm Range Invites", "blurb": "Pay attention to the registration completion grade. If the only way to reach you is via MDShooters " "forms or work chat you are at risk of having your invite retracted to make room for someone else " "that I can communicate with. " "Your invite registration completion will update as the additional info is entered into the " "system.<br /><br /> " "66% is fine, higher is better/easier." "<li>COMPLETE - I have Phone and email to reach you.</li>" "<li>85% - I have your phone number to reach you.</li>" "<li>66% - I have your email to reach you.</li>" "<li>5% - I only have MDShooters or work chat to reach you. <i>You're at risk of being removed from " "the invites.</i></li> " "", 'all_invites': all_invites, "copy_year": datetime.now().year # "copy_year": all_loads.prod } return render(request, "farminvite/calendar_list.html", context)
def page_buzz_words_or_phrases(request): step_hit_count_by_page(request.path) # lets hit the leach every time this page loads leach_buzzword() values = get_bingo_card_buzz_words() print(values) context = { "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Bingo: Buzz Words (or Phrases)", "values": values, "card_intent": "Take this buzz word card with you to your next meeting and play a game of Bingo instead of " "sleeping.", "blurb": get_page_blurb_override('bingo/buzz_word/'), } return render(request, "bingo/bingo_card.html", context)
def page_fantasy_grounds_list(request): step_hit_count_by_page(request.path) item_list = get_all_fantasy_grounds() perm_check = request.user.has_perm( 'content_collection.view_fantasygrounds') unrestricted = perm_check context = { "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Fantasy Grounds", "item_list": item_list, "blurb": get_page_blurb_override('content_collection/dnd5e/'), } return render(request, "content_collection/dnd5e.html", context)
def page_all_groundhog_removals_by_shooter_pk(request, shooter_pk=1): step_hit_count_by_page(request.path) all_news = all_groundhog_removals_by_shooter(shooter_pk) weather = get_weather(request) context = { # "restart": get_restart_notice, "copy_year": datetime.now().year, "weather": weather, "all_news": all_news, 'release': get_version_json(), "title": "Groundhog Logbook", "blurb": get_page_blurb_override('groundhog_logbook/by_shooter/'), } return render(request, "groundhog_logbook/all_groundhog_kills.html", context)
def page_groundhog_removals_scoreboard(request): step_hit_count_by_page(request.path) logs = groundhog_removal_scoreboard() context = { # "restart": get_restart_notice, "copy_year": datetime.now().year, "logs": logs, 'release': get_version_json(), "title": "Top Groundhog Removers", "blurb": get_page_blurb_override('groundhog_logbook/removal_scoreboard/'), } return render(request, "groundhog_logbook/groundhog_removal_scoreboard.html", context)
def page_videos(request): step_hit_count_by_page(request.path) videos = get_all_videos perm_check = request.user.has_perm('content_collection.view_video') unrestricted = perm_check context = { "videos": videos, "copy_year": datetime.now().year, 'release': get_version_json(), 'unrestricted_user': unrestricted, "title": "Videos: All (slow to load)", "blurb": get_page_blurb_override('content_collection/videos/'), } return render(request, "content_collection/videos.html", context)
def page_latest_video_by_pk(request, video_pk=1): step_hit_count_by_page(request.path) videos = get_video_by_pk(video_pk) perm_check = request.user.has_perm('content_collection.view_video') unrestricted = perm_check context = { "videos": videos, "copy_year": datetime.now().year, 'release': get_version_json(), 'unrestricted_user': unrestricted, "title": "Videos: #{video_id}".format(video_id=video_pk), "blurb": get_page_blurb_override('content_collection/videos/'), } return render(request, "content_collection/videos.html", context)
def page_charts_by_remover(request): step_hit_count_by_page(request.path) context = { "graph_api_node": '/groundhog_logbook/api/chart/by_remover/data/', "graph_header": "# of Groundhog Removals (By Remover)", "graph_message": "This is a total number of removals since we started tracking them.", # "restart": get_restart_notice, "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Groundhog Line Charts", "blurb": get_page_blurb_override('groundhog_logbook/graphic_charts/'), } return render(request, "groundhog_logbook/groundhog_graphic_generic.html", context)
def page_list_view(request): step_hit_count_by_page(request.path) orders = get_remaining_orders() perm_check = request.user.has_perm('deer_wait_list.view_thankfulness') unrestricted = perm_check context = { "copy_year": datetime.now().year, 'release': get_version_json(), "orders": orders, "unrestricted": unrestricted, "title": "Deer Wait List: List View", "blurb": get_page_blurb_override('deer_wait_list/list_view/'), } return render(request, "deer_wait_list/list_view.html", context)
def page_loads(request): all_loads = HandLoad.objects.all().order_by( 'Is_Sheriff_Load', '-prod', '-projectile__Diameter').annotate( prod=ExpressionWrapper(F('projectile__WeightGR') * 0.5 / 7000 / 32.127 * F('Velocity') * F('Velocity'), output_field=FloatField())) context = { 'release': get_version_json(), "title": "Master Po: Load Data", "blurb": "I'll move it to a database setup in a bit.", "table_data": 'This should be from the database... jackle.', 'all_loads': all_loads, "year": datetime.now().year } return render(request, "loaddata/djangoad.html", context)
def page_charts_by_year(request): step_hit_count_by_page(request.path) context = { "graph_api_node": '/deer_harvest_logbook/api/chart/by_year/data/', "graph_header": "# of Deer Removals (By Year)", "graph_message": "", # "restart": get_restart_notice, "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Deer Line Charts", "blurb": get_page_blurb_override('deer_harvest_logbook/graphic_charts/'), } return render(request, "deer_harvest_logbook/deer_graphic_generic.html", context)
def page_all_news(request): context = { "all_news": get_news, 'release': get_version_json(), "title": "All the news", "news_overview": "I've decided to make a blog of sorts. It's super light for speed and readability on " "cellphones. I'll expand functionality later but for now this is just a listing of the " "'Announcements' published.", "year": datetime.now().year } return render(request, "announcements/all_news.html", context)
def page_dnd5e_list(request): step_hit_count_by_page(request.path) item_list = get_all_dnd5e() perm_check = request.user.has_perm( 'content_collection.view_danddfiftheditionbook') unrestricted = perm_check context = { "copy_year": datetime.now().year, 'release': get_version_json(), "title": "D&D-5e", "item_list": item_list, "unrestricted_user": unrestricted, "blurb": get_page_blurb_override('content_collection/dnd5e/'), } return render(request, "content_collection/dnd5e.html", context)
def caliber_create_view_lkg(request): step_hit_count_by_page(request.path) form = CaliberForm(request.POST or None) if form.is_valid(): form.save() form = CaliberForm() context = { # "restart": get_restart_notice, 'release': get_version_json(), "title": "Caliber Creation Tool", # "blurb": "I moved the calculator to its own page.", "blurb": get_page_blurb_override('load_data/toolbox/create_caliber/'), "copy_year": datetime.now().year, 'form': form, } return render(request, "loaddata/caliber_create.html", context)
def page_sketch_list(request): step_hit_count_by_page(request.path) sketches = get_all_sketches perm_check = request.user.has_perm( 'content_collection.view_arduinounosketch') unrestricted = perm_check context = { "sketches": sketches, "copy_year": datetime.now().year, 'release': get_version_json(), 'unrestricted_user': unrestricted, "title": "Sketch List", "blurb": get_page_blurb_override('content_collection/sketches/'), } return render(request, "content_collection/sketches_list.html", context)
def page_carousel(request): step_hit_count_by_page(request.path) carousel = get_all_pictures_for_carousel() perm_check = request.user.has_perm( 'content_collection.view_picturesforcarousel') unrestricted = perm_check context = { "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Carousel (All)", 'unrestricted_user': unrestricted, "carousel": carousel, "blurb": get_page_blurb_override('content_collection/carousel/'), } return render(request, "content_collection/carousel.html", context)
def page_farm_check_list(request): context = { "restart": get_restart_notice, 'release': get_version_json(), "title": "What should I bring?", "blurb": "Pre-pack your car/truck it helps to prevent forgetting things.", "table_data": '<ul>' '<strong>Strongly recommended items</strong>' '<li>Ear protection<ul><li>Once mine are in, they don\'t come out for the day.</li></ul></li>' '<li>Eye protection<ul><li>Steel in the eye sucks.</li></ul></li>' '<li>Chair to sit on' '<ul><li>Being prone or standing for 4-8 hours is uncomfortable.</li></ul></li>' '<li>Shooting mat<ul><li>Keeps you out of the dirt/mud/snow and deer poop.</li></ul></li>' '<li>Firearm</li>' '<ul><li>ZEROED (or close) for your ammo.</li><li>AMMO for said firearm.</li></ul>' '<li>Snacks/Drinks for yourself.</li>' '<li>Sense of humor</li>' '<li>Targets (You want to shoot AT something?!)<ul>' '<li>Paper Targets<ul><li>Target Frame to hold targets.' '<ul><li>(Use mine with a $20 deposit.)</li></ul>' '<li>Stapler</li>' '<li>Marker to mark off hits to get the most out of your target.</li></ul>' '<li>AR500 steel plates</li>' '<ul><li>Bring your own or ' 'shoot my steel after ammo inspection, qualification and additional donation.</li></ul>' '<li>Plastic bottles filled with water (old soda bottles).</li>' '<li>Shotgun clays (great rifle targets at 100-600 yards)</li>' '</ul></li>' '</li></li>' '<br />' '<strong>Extras brownie points</strong>' '<li>Donations of brass (I\'ll use it or give it away to someone that can)</li>' '<br />' '<strong>What to <i>LEAVE AT HOME</i></strong>' '<li>Ego</li>' '</ul>', "copy_year": datetime.now().year } return render(request, "farminvite/simple_use_variables.html", context)
def page_farm_invites_view_hidden_listings(request): step_hit_count_by_page(request.path) this_moment = datetime.now() all_invites = InviteListing.objects.filter( Q(Show_Listing=False) & (Q(Invite_Date=this_moment.date()) | Q(Invite_Date__gt=this_moment.date()))).order_by('Invite_Date', 'Invite_Secondary', 'Desired_Time_Slot', ) context = { 'contact_good': 'Complete', 'contact_bad': 'Incomplete', 'release': get_version_json(), "title": "Invites Pending", 'all_invites': all_invites, "blurb": get_page_blurb_override('/farm_invite/pending/'), "copy_year": datetime.now().year } return render(request, "farminvite/calendar_list.html", context)
def page_page_hits(request): step_hit_count_by_page(request.path) page_hits = PageCounter.objects.\ exclude(page_name__in=PageHideList.objects.values('page_name')).order_by('-page_hit_count') page_hits = PageCounter.objects.exclude( page_name__in=PageHideList.objects.values('page_name'), ).order_by('-page_hit_count') context = { # "restart": get_restart_notice, 'release': get_version_json(), "title": "Hot Pages", "blurb": "See what others are looking at.", "page_hits": page_hits, "copy_year": datetime.now().year } return render(request, "imrunicorn/page_hits.html", context)
def page_all_groundhog_removals(request): step_hit_count_by_page(request.path) all_news = all_groundhog_removals(request) weather = get_weather(request) context = { "weather": weather, # "restart": get_restart_notice, "copy_year": datetime.now().year, "all_news": all_news, 'release': get_version_json(), "title": "Groundhog Logbook", # "blurb": "this is a blurb that goes on the page for testing. blah blah blah.", "blurb": get_page_blurb_override('groundhog_logbook/by_shooter/'), } # print(weather) return render(request, "groundhog_logbook/all_groundhog_kills.html", context)
def insult_list_all(request): # return HttpResponse("hello world") # get the list of todos # response = requests.get('https://jsonplaceholder.typicode.com/todos/') # transfer the response to json objects # todos = response.json() # send todos in context... BAM step_hit_count_by_page(request.path) insults = get_all_insults context = { "copy_year": datetime.now().year, 'release': get_version_json(), "title": "Content Collection: Insult", "insults": insults, "blurb": get_page_blurb_override('content_collection/insult/'), } return render(request, "content_collection/insult_list_all.html", context)
def page_home(request): step_hit_count_by_page(request.path) try: all_news = get_news_sticky() except IndexError as ie: print(ie) except Exception as err: print(err) try: main_blurb = get_main_page_blurb() except IndexError as ie: print(ie) except Exception as err: print(err) release = get_version_json() title = release['application_title'] cut = release['cut'] weather = get_weather(request) sun_info = get_sunrise_sunset() latest_sensor_reading = get_latest_sensor_reading() # print("sensor_reading[0].fahrenheit: {0}".format(sensor_reading[0].fahrenheit)) # print("latest_sensor_reading.fahrenheit: {0}".format(latest_sensor_reading.fahrenheit)) context = { "weather": weather, "latest_sensor_reading": latest_sensor_reading, "sun_info": sun_info, "main_blurb": main_blurb, # "restart": get_restart_notice, "all_news": all_news, 'release': release, "title": title, "cut": cut, # "blurb": get_main_page_blurb, "blurb": get_page_blurb_override('/'), "copy_year": datetime.now().year } return render(request, "imrunicorn/index.html", context)
def page_how_to_sign_up(request): context = { "restart": get_restart_notice, 'release': get_version_json(), "title": "How to sign up", "blurb": "The process to sign up is fairly simple.", "cash_app": "Show_QR_Code", "table_data": 'Make a donation and I\'ll get back with you. ' 'I\'m doing a required donation first approach this time. #lessonsLearned.' '<br /><br />Email me at: <a href="mailto:[email protected]">[email protected]</a> ' 'with your CashApp donation amount and CashApp name. Mine is $BenSpelledABC.', "copy_year": datetime.now().year } return render(request, "farminvite/simple_use_variables.html", context)
def page_charts(request): step_hit_count_by_page(request.path) logs = groundhogs_by_hour_of_day() logs_sexy = groundhogs_by_sex() logs_sexy_hour = groundhogs_by_hour_of_day_by_sex() context = { # "restart": get_restart_notice, "copy_year": datetime.now().year, "logs": logs, "logs_sexy": logs_sexy, "logs_sexy_hour": logs_sexy_hour, 'release': get_version_json(), "title": "Groundhog Charts", "blurb": get_page_blurb_override('groundhog_logbook/charts/'), } # <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> # etc etc # https://plotly.com/javascript/bar-charts/# # https://plotly.com/javascript/getting-started/ return render(request, "groundhog_logbook/groundhog_charts.html", context)
def page_request_slot(request): step_hit_count_by_page(request.path) context = { 'release': get_version_json(), "title": "Request Slot", "blurb": "Email Me To Request Slot", "table_data": 'The email must contain these items or I\'ll ignore the request. I\'ll add you to the secondary ' 'listing if primary is full. ' '<li>FirstName (so i dont call you dude/woman all day):</li>' '<li>Display Name (MDShoters name or something else. This is what\'s displayed on the listing ' 'page.):</li> ' '<li>Phone Number:</li>' '<li>E-Mail:</li>' '<li>Date Of Invite Requesting:</li>' '<li>AM or PM</li>' '<li><i>EMAIL SUBJECT: Aim Small Miss Small</i> (other subjects will be ignored)</li>' '<li>My Address: <a href="mailto:[email protected]">[email protected]</a></li>' '' , "copy_year": datetime.now().year } return render(request, "farminvite/simple_use_variables.html", context)