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 tweepy | |
import config | |
import json | |
def getClient(): | |
client = tweepy.Client(bearer_token=config.BEARER_TOKEN, | |
consumer_key=config.API_KEY, | |
consumer_secret=config.API_KEY_SECRET, | |
access_token=config.ACCESS_TOKEN, |
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
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Skolo</title> | |
<!-- Bootstrap CSS --> |
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 flask import Flask, render_template, request | |
import config | |
import blog | |
def page_not_found(e): | |
return render_template('404.html'), 404 | |
app = Flask(__name__) |
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 os | |
import openai | |
import config | |
openai.api_key = config.OPENAI_API_KEY | |
def generateBlogTopics(prompt1): | |
response = openai.Completion.create( |
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
def imageDetailPage(request, slug1, slug2): | |
category = Category.objects.get(slug=slug1) | |
image = Image.objects.get(slug=slug2) | |
context = {} | |
context['category'] = category | |
context['image'] = image | |
return render(request, 'main/image.html', context) |
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
def categoryPage(request, slug): | |
category = Category.objects.get(slug=slug) | |
images = Image.objects.filter(category=category).order_by('-date_created')[:6] | |
for x in images: | |
x.shortDescription = x.description[:130] | |
context = {} | |
context['images'] = images | |
context['category'] = category |
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.db import models | |
from django.template.defaultfilters import slugify | |
from django_resized import ResizedImageField | |
from django.utils import timezone | |
from uuid import uuid4 | |
from django.urls import reverse | |
class Category(models.Model): |
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
#Dont forget the view imports | |
def emailDocumentInvoice(request, slug): | |
#fetch that invoice | |
try: | |
invoice = Invoice.objects.get(slug=slug) | |
pass | |
except: | |
messages.error(request, 'Something went wrong') | |
return redirect('invoices') |
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.forms import widgets | |
from .models import * | |
#Form Layout from Crispy Forms | |
from crispy_forms.helper import FormHelper | |
from crispy_forms.layout import Layout, Submit, Row, Column | |
class DateInput(forms.DateInput): |
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
@login_required | |
def createBuildInvoice(request, slug): | |
#fetch that invoice | |
try: | |
invoice = Invoice.objects.get(slug=slug) | |
pass | |
except: | |
messages.error(request, 'Something went wrong') | |
return redirect('invoices') |