add flake8 and isort to pre-commit config, make flake8 and isort happy (#441)
* add flake8 to pre-commit config, and fixup many things to make flake8 happy * add isort and sort all imports, add to pre-commit and requirements
This commit is contained in:
parent
8441620376
commit
00af109e2f
7
.isort.cfg
Normal file
7
.isort.cfg
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[settings]
|
||||||
|
multi_line_output=3
|
||||||
|
include_trailing_comma=True
|
||||||
|
force_grid_wrap=0
|
||||||
|
use_parentheses=True
|
||||||
|
line_length=88
|
||||||
|
|
|
@ -4,4 +4,11 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: "black"
|
- id: "black"
|
||||||
language_version: "python3.7"
|
language_version: "python3.7"
|
||||||
|
- repo: "https://github.com/pre-commit/pre-commit-hooks"
|
||||||
|
rev: "v2.3.0"
|
||||||
|
hooks:
|
||||||
|
- id: "flake8"
|
||||||
|
- repo: "https://github.com/pre-commit/mirrors-isort"
|
||||||
|
rev: "v4.3.21"
|
||||||
|
hooks:
|
||||||
|
- id: "isort"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
|
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
|
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
|
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
|
||||||
|
|
|
@ -1,6 +1,34 @@
|
||||||
from django.urls import path, include
|
from django.urls import include, path
|
||||||
from .views import *
|
|
||||||
|
|
||||||
|
from .views import (
|
||||||
|
ApproveNamesView,
|
||||||
|
BackofficeIndexView,
|
||||||
|
BadgeHandoutView,
|
||||||
|
ChainDetailView,
|
||||||
|
ChainListView,
|
||||||
|
CredebtorDetailView,
|
||||||
|
EventProposalManageView,
|
||||||
|
ExpenseDetailView,
|
||||||
|
ExpenseListView,
|
||||||
|
ManageProposalsView,
|
||||||
|
MerchandiseOrdersView,
|
||||||
|
MerchandiseToOrderView,
|
||||||
|
ProductHandoutView,
|
||||||
|
ReimbursementCreateUserSelectView,
|
||||||
|
ReimbursementCreateView,
|
||||||
|
ReimbursementDeleteView,
|
||||||
|
ReimbursementDetailView,
|
||||||
|
ReimbursementListView,
|
||||||
|
ReimbursementUpdateView,
|
||||||
|
RevenueDetailView,
|
||||||
|
RevenueListView,
|
||||||
|
ScanTicketsView,
|
||||||
|
ShopTicketOverview,
|
||||||
|
SpeakerProposalManageView,
|
||||||
|
TicketCheckinView,
|
||||||
|
VillageOrdersView,
|
||||||
|
VillageToOrderView,
|
||||||
|
)
|
||||||
|
|
||||||
app_name = "backoffice"
|
app_name = "backoffice"
|
||||||
|
|
||||||
|
@ -9,7 +37,7 @@ urlpatterns = [
|
||||||
# infodesk
|
# infodesk
|
||||||
path(
|
path(
|
||||||
"infodesk/",
|
"infodesk/",
|
||||||
include([path("", ScanTicketsView.as_view(), name="scan_tickets"),]),
|
include([path("", ScanTicketsView.as_view(), name="scan_tickets")]),
|
||||||
),
|
),
|
||||||
path("shop_tickets/", ShopTicketOverview.as_view(), name="shop_ticket_overview"),
|
path("shop_tickets/", ShopTicketOverview.as_view(), name="shop_ticket_overview"),
|
||||||
path("product_handout/", ProductHandoutView.as_view(), name="product_handout"),
|
path("product_handout/", ProductHandoutView.as_view(), name="product_handout"),
|
||||||
|
|
|
@ -8,20 +8,27 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
from django.db.models import Sum
|
from django.db.models import Sum
|
||||||
from django.shortcuts import redirect, get_object_or_404
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.generic import TemplateView, ListView, DetailView
|
from django.views.generic import DetailView, ListView, TemplateView
|
||||||
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||||
|
|
||||||
from camps.mixins import CampViewMixin
|
from camps.mixins import CampViewMixin
|
||||||
from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue
|
from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue
|
||||||
from profiles.models import Profile
|
from profiles.models import Profile
|
||||||
from program.models import SpeakerProposal, EventProposal
|
from program.models import EventProposal, SpeakerProposal
|
||||||
from shop.models import OrderProductRelation, Order
|
from shop.models import Order, OrderProductRelation
|
||||||
from teams.models import Team
|
from teams.models import Team
|
||||||
from tickets.models import ShopTicket, SponsorTicket, DiscountTicket, TicketType
|
from tickets.models import DiscountTicket, ShopTicket, SponsorTicket, TicketType
|
||||||
from .mixins import *
|
|
||||||
|
from .mixins import (
|
||||||
|
ContentTeamPermissionMixin,
|
||||||
|
EconomyTeamPermissionMixin,
|
||||||
|
InfoTeamPermissionMixin,
|
||||||
|
OrgaTeamPermissionMixin,
|
||||||
|
RaisePermissionRequiredMixin,
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
@ -236,7 +243,7 @@ class VillageToOrderView(CampViewMixin, OrgaTeamPermissionMixin, TemplateView):
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
###### CHAINS & CREDEBTORS #####
|
# CHAINS & CREDEBTORS
|
||||||
|
|
||||||
|
|
||||||
class ChainListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
class ChainListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
||||||
|
@ -257,7 +264,7 @@ class CredebtorDetailView(CampViewMixin, EconomyTeamPermissionMixin, DetailView)
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
########### EXPENSES ###########
|
# EXPENSES
|
||||||
|
|
||||||
|
|
||||||
class ExpenseListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
class ExpenseListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
||||||
|
@ -306,7 +313,7 @@ class ExpenseDetailView(CampViewMixin, EconomyTeamPermissionMixin, UpdateView):
|
||||||
|
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
########### REIMBURSEMENTS ###########
|
# REIMBURSEMENTS
|
||||||
|
|
||||||
|
|
||||||
class ReimbursementListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
class ReimbursementListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
||||||
|
@ -497,7 +504,7 @@ class ReimbursementDeleteView(CampViewMixin, EconomyTeamPermissionMixin, DeleteV
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
########### REVENUES ###########
|
# REVENUES
|
||||||
|
|
||||||
|
|
||||||
class RevenueListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
class RevenueListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import ProductCategory, Product
|
|
||||||
|
from .models import Product, ProductCategory
|
||||||
|
|
||||||
|
|
||||||
@admin.register(ProductCategory)
|
@admin.register(ProductCategory)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2017-08-25 23:28
|
# Generated by Django 1.10.5 on 2017-08-25 23:28
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2017-09-16 19:28
|
# Generated by Django 1.10.5 on 2017-09-16 19:28
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2018-03-18 08:06
|
# Generated by Django 1.10.5 on 2018-03-18 08:06
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from utils.models import CampRelatedModel
|
from utils.models import CampRelatedModel
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from camps.mixins import CampViewMixin
|
|
||||||
from .models import ProductCategory
|
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
|
|
||||||
|
from camps.mixins import CampViewMixin
|
||||||
|
|
||||||
|
from .models import ProductCategory
|
||||||
|
|
||||||
|
|
||||||
class MenuView(CampViewMixin, ListView):
|
class MenuView(CampViewMixin, ListView):
|
||||||
model = ProductCategory
|
model = ProductCategory
|
||||||
|
|
|
@ -3,6 +3,7 @@ ASGI entrypoint. Configures Django and then runs the application
|
||||||
defined in the ASGI_APPLICATION setting.
|
defined in the ASGI_APPLICATION setting.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from channels.routing import get_default_application
|
from channels.routing import get_default_application
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
|
from channels.auth import AuthMiddlewareStack
|
||||||
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
||||||
from channels.auth import AuthMiddlewareStack
|
|
||||||
from program.consumers import ScheduleConsumer
|
from program.consumers import ScheduleConsumer
|
||||||
|
|
||||||
|
|
||||||
application = ProtocolTypeRouter(
|
application = ProtocolTypeRouter(
|
||||||
{
|
{
|
||||||
"websocket": AuthMiddlewareStack(
|
"websocket": AuthMiddlewareStack(
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
from graphene import relay, Schema, ObjectType
|
from graphene import ObjectType, Schema, relay
|
||||||
|
|
||||||
from graphene_django import DjangoObjectType
|
from graphene_django import DjangoObjectType
|
||||||
from graphene_django.filter import DjangoFilterConnectionField
|
from graphene_django.filter import DjangoFilterConnectionField
|
||||||
|
|
||||||
from camps.models import Camp
|
from camps.models import Camp
|
||||||
|
|
||||||
from program.schema import ProgramQuery
|
from program.schema import ProgramQuery
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
from allauth.account.views import LoginView, LogoutView
|
from allauth.account.views import LoginView, LogoutView
|
||||||
|
from django.conf import settings
|
||||||
from django.conf.urls import include
|
from django.conf.urls import include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.views.generic import TemplateView
|
||||||
from graphene_django.views import GraphQLView
|
from graphene_django.views import GraphQLView
|
||||||
|
|
||||||
from bar.views import MenuView
|
from bar.views import MenuView
|
||||||
from camps.views import *
|
from camps.views import CampDetailView, CampListView, CampRedirectView
|
||||||
from feedback.views import FeedbackCreate
|
from feedback.views import FeedbackCreate
|
||||||
from info.views import *
|
from info.views import CampInfoView
|
||||||
from people.views import *
|
from people.views import PeopleView
|
||||||
from program.views import *
|
from sponsors.views import SponsorsView
|
||||||
from sponsors.views import *
|
from villages.views import (
|
||||||
from villages.views import *
|
VillageCreateView,
|
||||||
|
VillageDeleteView,
|
||||||
|
VillageDetailView,
|
||||||
|
VillageListView,
|
||||||
|
VillageUpdateView,
|
||||||
|
)
|
||||||
|
|
||||||
# require 2fa token entry (if enabled on admin account) when logging into /admin by using allauth login form
|
# require 2fa token entry (if enabled on admin account) when logging into /admin by using allauth login form
|
||||||
admin.site.login = login_required(admin.site.login)
|
admin.site.login = login_required(admin.site.login)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import factory
|
import factory
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from factory.django import DjangoModelFactory
|
from factory.django import DjangoModelFactory
|
||||||
from psycopg2._range import DateTimeTZRange
|
from psycopg2._range import DateTimeTZRange
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.conf import settings
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.9.1 on 2016-01-17 17:18
|
# Generated by Django 1.9.1 on 2016-01-17 17:18
|
||||||
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from camps.models import Camp
|
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.utils.functional import cached_property
|
|
||||||
|
from camps.models import Camp
|
||||||
|
|
||||||
|
|
||||||
class CampViewMixin(object):
|
class CampViewMixin(object):
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
from django.db import models
|
|
||||||
from utils.models import UUIDModel, CreatedUpdatedModel
|
|
||||||
from program.models import EventType, EventLocation
|
|
||||||
from django.contrib.postgres.fields import DateTimeRangeField
|
|
||||||
from psycopg2.extras import DateTimeTZRange
|
|
||||||
from django.core.exceptions import ValidationError
|
|
||||||
from datetime import timedelta
|
|
||||||
from django.utils import timezone
|
|
||||||
from django.urls import reverse
|
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.contrib.postgres.fields import DateTimeRangeField
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import models
|
||||||
|
from django.urls import reverse
|
||||||
|
from psycopg2.extras import DateTimeTZRange
|
||||||
|
|
||||||
|
from program.models import EventLocation, EventType
|
||||||
|
from utils.models import CreatedUpdatedModel, UUIDModel
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from camps.models import Camp
|
|
||||||
from django.utils import timezone
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from camps.models import Camp
|
||||||
|
|
||||||
|
|
||||||
def get_current_camp():
|
def get_current_camp():
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
from django.views.generic import ListView, DetailView
|
|
||||||
from django.utils import timezone
|
|
||||||
from .models import Camp
|
|
||||||
from django.shortcuts import redirect
|
|
||||||
from .mixins import CampViewMixin
|
|
||||||
from django.views import View
|
|
||||||
from django.conf import settings
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from django.utils import timezone
|
||||||
|
from django.views import View
|
||||||
|
from django.views.generic import DetailView, ListView
|
||||||
|
|
||||||
|
from .mixins import CampViewMixin
|
||||||
|
from .models import Camp
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ from django.contrib import admin
|
||||||
|
|
||||||
from .models import Chain, Credebtor, Expense, Reimbursement, Revenue
|
from .models import Chain, Credebtor, Expense, Reimbursement, Revenue
|
||||||
|
|
||||||
|
###############################
|
||||||
### chains and credebtors
|
# chains and credebtors
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Chain)
|
@admin.register(Chain)
|
||||||
|
@ -14,13 +14,14 @@ class ChainAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Credebtor)
|
@admin.register(Credebtor)
|
||||||
class ChainAdmin(admin.ModelAdmin):
|
class CredebtorAdmin(admin.ModelAdmin):
|
||||||
list_filter = ["chain", "name"]
|
list_filter = ["chain", "name"]
|
||||||
list_display = ["chain", "name", "notes"]
|
list_display = ["chain", "name", "notes"]
|
||||||
search_fields = ["chain", "name", "notes"]
|
search_fields = ["chain", "name", "notes"]
|
||||||
|
|
||||||
|
|
||||||
### expenses
|
###############################
|
||||||
|
# expenses
|
||||||
|
|
||||||
|
|
||||||
def approve_expenses(modeladmin, request, queryset):
|
def approve_expenses(modeladmin, request, queryset):
|
||||||
|
@ -64,7 +65,8 @@ class ExpenseAdmin(admin.ModelAdmin):
|
||||||
actions = [approve_expenses, reject_expenses]
|
actions = [approve_expenses, reject_expenses]
|
||||||
|
|
||||||
|
|
||||||
### revenues
|
###############################
|
||||||
|
# revenues
|
||||||
|
|
||||||
|
|
||||||
def approve_revenues(modeladmin, request, queryset):
|
def approve_revenues(modeladmin, request, queryset):
|
||||||
|
@ -99,7 +101,8 @@ class RevenueAdmin(admin.ModelAdmin):
|
||||||
actions = [approve_revenues, reject_revenues]
|
actions = [approve_revenues, reject_revenues]
|
||||||
|
|
||||||
|
|
||||||
### reimbursements
|
###############################
|
||||||
|
# reimbursements
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Reimbursement)
|
@admin.register(Reimbursement)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import os, magic, copy
|
import copy
|
||||||
|
|
||||||
|
import magic
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from .models import Expense, Revenue
|
from .models import Expense, Revenue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# Generated by Django 2.0.4 on 2018-08-29 22:14
|
# Generated by Django 2.0.4 on 2018-08-29 22:14
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# Generated by Django 2.0.4 on 2018-09-16 13:27
|
# Generated by Django 2.0.4 on 2018-09-16 13:27
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.0.4 on 2018-09-17 17:33
|
# Generated by Django 2.0.4 on 2018-09-17 17:33
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Generated by Django 2.1.3 on 2018-11-20 17:35
|
# Generated by Django 2.1.3 on 2018-11-20 17:35
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# Generated by Django 2.1.7 on 2019-03-27 16:21
|
# Generated by Django 2.1.7 on 2019-03-27 16:21
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.1.7 on 2019-03-30 09:45
|
# Generated by Django 2.1.7 on 2019-03-30 09:45
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.http import HttpResponseRedirect, Http404
|
from django.http import Http404
|
||||||
from django.shortcuts import redirect, get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
from .models import Chain, Credebtor
|
from .models import Chain, Credebtor
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import models
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import models
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
||||||
from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel
|
from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel
|
||||||
from .email import *
|
|
||||||
|
from .email import (
|
||||||
|
send_accountingsystem_expense_email,
|
||||||
|
send_accountingsystem_revenue_email,
|
||||||
|
send_expense_approved_email,
|
||||||
|
send_expense_rejected_email,
|
||||||
|
send_revenue_approved_email,
|
||||||
|
send_revenue_rejected_email,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ChainManager(models.Manager):
|
class ChainManager(models.Manager):
|
||||||
|
@ -219,9 +225,9 @@ class Revenue(CampRelatedModel, UUIDModel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def approval_status(self):
|
def approval_status(self):
|
||||||
if self.approved == None:
|
if self.approved is None:
|
||||||
return "Pending approval"
|
return "Pending approval"
|
||||||
elif self.approved == True:
|
elif self.approved:
|
||||||
return "Approved"
|
return "Approved"
|
||||||
else:
|
else:
|
||||||
return "Rejected"
|
return "Rejected"
|
||||||
|
@ -350,9 +356,9 @@ class Expense(CampRelatedModel, UUIDModel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def approval_status(self):
|
def approval_status(self):
|
||||||
if self.approved == None:
|
if self.approved is None:
|
||||||
return "Pending approval"
|
return "Pending approval"
|
||||||
elif self.approved == True:
|
elif self.approved:
|
||||||
return "Approved"
|
return "Approved"
|
||||||
else:
|
else:
|
||||||
return "Rejected"
|
return "Rejected"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Economy | {{ block.super }}
|
Economy | {{ block.super }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Expenses | {{ block.super }}
|
Expenses | {{ block.super }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Expenses | {{ block.super }}
|
Expenses | {{ block.super }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Revenues | {{ block.super }}
|
Revenues | {{ block.super }}
|
||||||
|
|
|
@ -1,5 +1,26 @@
|
||||||
from django.urls import path, include
|
from django.urls import include, path
|
||||||
from .views import *
|
|
||||||
|
from .views import (
|
||||||
|
ChainCreateView,
|
||||||
|
ChainListView,
|
||||||
|
CredebtorCreateView,
|
||||||
|
CredebtorListView,
|
||||||
|
EconomyDashboardView,
|
||||||
|
ExpenseCreateView,
|
||||||
|
ExpenseDeleteView,
|
||||||
|
ExpenseDetailView,
|
||||||
|
ExpenseInvoiceView,
|
||||||
|
ExpenseListView,
|
||||||
|
ExpenseUpdateView,
|
||||||
|
ReimbursementDetailView,
|
||||||
|
ReimbursementListView,
|
||||||
|
RevenueCreateView,
|
||||||
|
RevenueDeleteView,
|
||||||
|
RevenueDetailView,
|
||||||
|
RevenueInvoiceView,
|
||||||
|
RevenueListView,
|
||||||
|
RevenueUpdateView,
|
||||||
|
)
|
||||||
|
|
||||||
app_name = "economy"
|
app_name = "economy"
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,40 @@
|
||||||
import os, magic
|
import os
|
||||||
|
|
||||||
from django.shortcuts import render, redirect
|
import magic
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.http import HttpResponseRedirect, HttpResponse, Http404
|
from django.db.models import Sum
|
||||||
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
|
from django.shortcuts import redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.views.generic import (
|
from django.views.generic import (
|
||||||
CreateView,
|
CreateView,
|
||||||
ListView,
|
|
||||||
DetailView,
|
DetailView,
|
||||||
|
ListView,
|
||||||
TemplateView,
|
TemplateView,
|
||||||
UpdateView,
|
UpdateView,
|
||||||
DeleteView,
|
|
||||||
)
|
)
|
||||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
|
||||||
from django.db.models import Sum
|
|
||||||
|
|
||||||
from camps.mixins import CampViewMixin
|
from camps.mixins import CampViewMixin
|
||||||
|
from teams.models import Team
|
||||||
from utils.email import add_outgoing_email
|
from utils.email import add_outgoing_email
|
||||||
from utils.mixins import RaisePermissionRequiredMixin
|
from utils.mixins import RaisePermissionRequiredMixin
|
||||||
from teams.models import Team
|
|
||||||
from .models import *
|
from .forms import (
|
||||||
from .mixins import *
|
ExpenseCreateForm,
|
||||||
from .forms import *
|
ExpenseUpdateForm,
|
||||||
|
RevenueCreateForm,
|
||||||
|
RevenueUpdateForm,
|
||||||
|
)
|
||||||
|
from .mixins import (
|
||||||
|
ChainViewMixin,
|
||||||
|
CredebtorViewMixin,
|
||||||
|
ExpensePermissionMixin,
|
||||||
|
ReimbursementPermissionMixin,
|
||||||
|
RevenuePermissionMixin,
|
||||||
|
)
|
||||||
|
from .models import Chain, Credebtor, Expense, Reimbursement, Revenue
|
||||||
|
|
||||||
|
|
||||||
class EconomyDashboardView(LoginRequiredMixin, CampViewMixin, TemplateView):
|
class EconomyDashboardView(LoginRequiredMixin, CampViewMixin, TemplateView):
|
||||||
|
@ -89,7 +100,8 @@ class EconomyDashboardView(LoginRequiredMixin, CampViewMixin, TemplateView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
########### Chain/Creditor related views ###############
|
############################################
|
||||||
|
# Chain/Credebtor related views
|
||||||
|
|
||||||
|
|
||||||
class ChainCreateView(CampViewMixin, RaisePermissionRequiredMixin, CreateView):
|
class ChainCreateView(CampViewMixin, RaisePermissionRequiredMixin, CreateView):
|
||||||
|
@ -174,7 +186,8 @@ class CredebtorListView(
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
########### Expense related views ###############
|
############################################
|
||||||
|
# Expense related views
|
||||||
|
|
||||||
|
|
||||||
class ExpenseListView(LoginRequiredMixin, CampViewMixin, ListView):
|
class ExpenseListView(LoginRequiredMixin, CampViewMixin, ListView):
|
||||||
|
@ -322,7 +335,8 @@ class ExpenseInvoiceView(CampViewMixin, ExpensePermissionMixin, DetailView):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
########### Reimbursement related views ###############
|
############################################
|
||||||
|
# Reimbursement related views
|
||||||
|
|
||||||
|
|
||||||
class ReimbursementListView(LoginRequiredMixin, CampViewMixin, ListView):
|
class ReimbursementListView(LoginRequiredMixin, CampViewMixin, ListView):
|
||||||
|
@ -339,7 +353,8 @@ class ReimbursementDetailView(CampViewMixin, ReimbursementPermissionMixin, Detai
|
||||||
template_name = "reimbursement_detail.html"
|
template_name = "reimbursement_detail.html"
|
||||||
|
|
||||||
|
|
||||||
########### Revenue related views ###############
|
############################################
|
||||||
|
# Revenue related views
|
||||||
|
|
||||||
|
|
||||||
class RevenueListView(LoginRequiredMixin, CampViewMixin, ListView):
|
class RevenueListView(LoginRequiredMixin, CampViewMixin, ListView):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import Type, Routing
|
|
||||||
|
from .models import Routing, Type
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Type)
|
@admin.register(Type)
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
from django.utils import timezone
|
|
||||||
from datetime import timedelta
|
|
||||||
from ircbot.utils import add_irc_message
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from ircbot.utils import add_irc_message
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,3 +92,4 @@ def team_email_notification(
|
||||||
recipient_list = [resp.email for resp in team.responsible_members.all()]
|
recipient_list = [resp.email for resp in team.responsible_members.all()]
|
||||||
|
|
||||||
# TODO: actually send the email here
|
# TODO: actually send the email here
|
||||||
|
logger.debug(f"sending test email to {recipient_list}")
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2018-03-18 13:16
|
# Generated by Django 1.10.5 on 2018-03-18 13:16
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from utils.models import CreatedUpdatedModel
|
|
||||||
from teams.models import Team
|
from teams.models import Team
|
||||||
|
from utils.models import CreatedUpdatedModel
|
||||||
|
|
||||||
|
|
||||||
class Type(CreatedUpdatedModel):
|
class Type(CreatedUpdatedModel):
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
|
|
@ -1,9 +1,10 @@
|
||||||
# Generated by Django 2.1 on 2018-08-20 13:13
|
# Generated by Django 2.1 on 2018-08-20 13:13
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.1 on 2018-08-20 13:51
|
# Generated by Django 2.1 on 2018-08-20 13:51
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from utils.models import UUIDModel, CreatedUpdatedModel, CampRelatedModel
|
from utils.models import CampRelatedModel, UUIDModel
|
||||||
|
|
||||||
|
|
||||||
class Feedback(CampRelatedModel, UUIDModel):
|
class Feedback(CampRelatedModel, UUIDModel):
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
|
@ -6,6 +6,7 @@ from django.views.generic import CreateView
|
||||||
|
|
||||||
from camps.mixins import CampViewMixin
|
from camps.mixins import CampViewMixin
|
||||||
from tokens.models import Token
|
from tokens.models import Token
|
||||||
|
|
||||||
from .models import Feedback
|
from .models import Feedback
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from reversion.admin import VersionAdmin
|
from reversion.admin import VersionAdmin
|
||||||
from .models import InfoItem, InfoCategory
|
|
||||||
|
from .models import InfoCategory, InfoItem
|
||||||
|
|
||||||
|
|
||||||
@admin.register(InfoItem)
|
@admin.register(InfoItem)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.4 on 2016-12-24 22:11
|
# Generated by Django 1.10.4 on 2016-12-24 22:11
|
||||||
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.0.4 on 2018-05-04 21:11
|
# Generated by Django 2.0.4 on 2018-05-04 21:11
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.0.4 on 2018-05-08 07:42
|
# Generated by Django 2.0.4 on 2018-05-08 07:42
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
def add_teams_to_categories(apps, schema_editor):
|
def add_teams_to_categories(apps, schema_editor):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.0.4 on 2018-05-20 16:13
|
# Generated by Django 2.0.4 on 2018-05-20 16:13
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 2.0.4 on 2018-05-20 20:11
|
# Generated by Django 2.0.4 on 2018-05-20 20:11
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from django.db import models
|
|
||||||
from utils.models import CampRelatedModel
|
|
||||||
from django.core.exceptions import ValidationError
|
|
||||||
|
|
||||||
import reversion
|
import reversion
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from utils.models import CampRelatedModel
|
||||||
|
|
||||||
|
|
||||||
class InfoCategory(CampRelatedModel):
|
class InfoCategory(CampRelatedModel):
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
from .models import *
|
|
||||||
from camps.mixins import CampViewMixin
|
from camps.mixins import CampViewMixin
|
||||||
|
|
||||||
|
from .models import InfoCategory
|
||||||
|
|
||||||
|
|
||||||
class CampInfoView(CampViewMixin, ListView):
|
class CampInfoView(CampViewMixin, ListView):
|
||||||
model = InfoCategory
|
model = InfoCategory
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import OutgoingIrcMessage
|
from .models import OutgoingIrcMessage
|
||||||
|
|
||||||
admin.site.register(OutgoingIrcMessage)
|
admin.site.register(OutgoingIrcMessage)
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import irc3, re
|
import logging
|
||||||
from ircbot.models import OutgoingIrcMessage
|
import re
|
||||||
from teams.models import Team, TeamMember
|
|
||||||
|
import irc3
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from events.models import Routing
|
|
||||||
from teams.utils import get_team_from_irc_channel
|
|
||||||
|
|
||||||
import logging
|
from ircbot.models import OutgoingIrcMessage
|
||||||
|
from teams.models import Team, TeamMember
|
||||||
|
from teams.utils import get_team_from_irc_channel
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ class Plugin(object):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
### builtin irc3 event methods
|
# builtin irc3 event methods
|
||||||
|
|
||||||
def server_ready(self, **kwargs):
|
def server_ready(self, **kwargs):
|
||||||
"""triggered after the server sent the MOTD (require core plugin)"""
|
"""triggered after the server sent the MOTD (require core plugin)"""
|
||||||
|
@ -54,7 +55,7 @@ class Plugin(object):
|
||||||
logger.debug("inside connection_made(), kwargs: %s" % kwargs)
|
logger.debug("inside connection_made(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
### decorated irc3 event methods
|
# decorated irc3 event methods
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.JOIN_PART_QUIT)
|
@irc3.event(irc3.rfc.JOIN_PART_QUIT)
|
||||||
def on_join_part_quit(self, **kwargs):
|
def on_join_part_quit(self, **kwargs):
|
||||||
|
@ -104,7 +105,7 @@ class Plugin(object):
|
||||||
logger.debug("inside on_kick(), kwargs: %s" % kwargs)
|
logger.debug("inside on_kick(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
### custom irc3 methods below here
|
# custom irc3 methods below here
|
||||||
|
|
||||||
@irc3.extend
|
@irc3.extend
|
||||||
def do_stuff(self):
|
def do_stuff(self):
|
||||||
|
@ -158,7 +159,7 @@ class Plugin(object):
|
||||||
logger.warning("skipping message to %s" % msg.target)
|
logger.warning("skipping message to %s" % msg.target)
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
### irc channel methods
|
# irc channel methods
|
||||||
|
|
||||||
@irc3.extend
|
@irc3.extend
|
||||||
def check_irc_channels(self):
|
def check_irc_channels(self):
|
||||||
|
@ -377,7 +378,7 @@ class Plugin(object):
|
||||||
self.bot.setup_public_channel(team.public_irc_channel_name)
|
self.bot.setup_public_channel(team.public_irc_channel_name)
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
### services (ChanServ & NickServ) methods
|
# services (ChanServ & NickServ) methods
|
||||||
|
|
||||||
@irc3.extend
|
@irc3.extend
|
||||||
def handle_chanserv_privmsg(self, **kwargs):
|
def handle_chanserv_privmsg(self, **kwargs):
|
||||||
|
@ -429,7 +430,6 @@ class Plugin(object):
|
||||||
if match:
|
if match:
|
||||||
# the irc channel is now registered
|
# the irc channel is now registered
|
||||||
channel = match.group(1)
|
channel = match.group(1)
|
||||||
botnick = match.group(2)
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Channel %s was registered with ChanServ, looking up Team..." % channel
|
"Channel %s was registered with ChanServ, looking up Team..." % channel
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.conf import settings
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import irc3
|
import irc3
|
||||||
from events.models import Routing
|
from django.conf import settings
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
@ -33,5 +33,5 @@ def do_work():
|
||||||
try:
|
try:
|
||||||
irc3.IrcBot(**config).run(forever=True)
|
irc3.IrcBot(**config).run(forever=True)
|
||||||
except Exception as E:
|
except Exception as E:
|
||||||
logger.exception("Got exception inside do_work for %s" % self.workermodule)
|
logger.exception("Got exception inside irc3.IrcBot.run()")
|
||||||
raise E
|
raise E
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from utils.models import CreatedUpdatedModel
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from utils.models import CreatedUpdatedModel
|
||||||
|
|
||||||
|
|
||||||
class OutgoingIrcMessage(CreatedUpdatedModel):
|
class OutgoingIrcMessage(CreatedUpdatedModel):
|
||||||
target = models.CharField(max_length=100)
|
target = models.CharField(max_length=100)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.conf import settings
|
|
||||||
from django.utils import timezone
|
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.text import slugify
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.text import slugify
|
||||||
|
|
||||||
from utils.models import CreatedUpdatedModel
|
from utils.models import CreatedUpdatedModel
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_name = "news"
|
app_name = "news"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.views.generic import ListView, DetailView
|
|
||||||
from django.utils import timezone
|
|
||||||
from django.contrib.syndication.views import Feed
|
from django.contrib.syndication.views import Feed
|
||||||
|
from django.utils import timezone
|
||||||
|
from django.views.generic import DetailView, ListView
|
||||||
|
|
||||||
from .models import NewsItem
|
from .models import NewsItem
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
|
|
||||||
from camps.models import Camp
|
from camps.models import Camp
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import Profile
|
from .models import Profile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from django.apps import AppConfig
|
|
||||||
from django.db.models.signals import pre_save, post_save
|
|
||||||
from .signal_handlers import create_profile, profile_pre_save
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.apps import AppConfig
|
||||||
|
from django.db.models.signals import post_save, pre_save
|
||||||
|
|
||||||
|
from .signal_handlers import create_profile, profile_pre_save
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
|
||||||
from django.conf import settings
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from utils.models import UUIDModel, CreatedUpdatedModel
|
from utils.models import CreatedUpdatedModel, UUIDModel
|
||||||
|
|
||||||
|
|
||||||
class Profile(CreatedUpdatedModel, UUIDModel):
|
class Profile(CreatedUpdatedModel, UUIDModel):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.db.models.signals import post_save, pre_save
|
|
||||||
from events.handler import handle_team_event
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from events.handler import handle_team_event
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
||||||
from django.views.generic import DetailView, UpdateView
|
|
||||||
from django.urls import reverse_lazy
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.urls import reverse_lazy
|
||||||
|
from django.views.generic import DetailView, UpdateView
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
from django.contrib import admin, messages
|
from django.contrib import admin, messages
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Event,
|
Event,
|
||||||
Speaker,
|
|
||||||
EventType,
|
|
||||||
EventInstance,
|
EventInstance,
|
||||||
EventLocation,
|
EventLocation,
|
||||||
EventTrack,
|
|
||||||
SpeakerProposal,
|
|
||||||
EventProposal,
|
EventProposal,
|
||||||
|
EventTrack,
|
||||||
|
EventType,
|
||||||
Favorite,
|
Favorite,
|
||||||
UrlType,
|
Speaker,
|
||||||
|
SpeakerProposal,
|
||||||
Url,
|
Url,
|
||||||
|
UrlType,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class ProgramConfig(AppConfig):
|
||||||
name = "program"
|
name = "program"
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
from .models import Speaker, SpeakerProposal, EventProposal
|
from .models import Speaker
|
||||||
from .signal_handlers import (
|
from .signal_handlers import (
|
||||||
check_speaker_event_camp_consistency,
|
check_speaker_event_camp_consistency,
|
||||||
check_speaker_camp_change,
|
check_speaker_camp_change,
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
from channels.generic.websocket import JsonWebsocketConsumer
|
from channels.generic.websocket import JsonWebsocketConsumer
|
||||||
|
|
||||||
from camps.models import Camp
|
from camps.models import Camp
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Event,
|
Event,
|
||||||
EventInstance,
|
EventInstance,
|
||||||
Favorite,
|
|
||||||
EventLocation,
|
EventLocation,
|
||||||
EventType,
|
|
||||||
EventTrack,
|
EventTrack,
|
||||||
|
EventType,
|
||||||
|
Favorite,
|
||||||
Speaker,
|
Speaker,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
from utils.email import add_outgoing_email
|
|
||||||
from teams.models import Team
|
from teams.models import Team
|
||||||
import logging
|
from utils.email import add_outgoing_email
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
from .models import SpeakerProposal, EventProposal, EventTrack, Url, UrlType
|
from .models import EventProposal, EventTrack, SpeakerProposal, Url, UrlType
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
from django.core.management.base import BaseCommand
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils import timezone
|
|
||||||
from time import sleep
|
|
||||||
import irc3, sys, asyncio
|
|
||||||
from ircbot.models import OutgoingIrcMessage
|
|
||||||
from camps.utils import get_current_camp
|
|
||||||
from django.utils import timezone
|
|
||||||
from program.models import EventInstance
|
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import timedelta
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from camps.utils import get_current_camp
|
||||||
|
from ircbot.models import OutgoingIrcMessage
|
||||||
|
from program.models import EventInstance
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.9.6 on 2016-07-13 19:38
|
# Generated by Django 1.9.6 on 2016-07-13 19:38
|
||||||
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.4 on 2016-12-12 18:09
|
# Generated by Django 1.10.4 on 2016-12-12 18:09
|
||||||
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2017-01-21 12:12
|
# Generated by Django 1.10.5 on 2017-01-21 12:12
|
||||||
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2017-01-22 13:39
|
# Generated by Django 1.10.5 on 2017-01-22 13:39
|
||||||
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2017-02-05 18:40
|
# Generated by Django 1.10.5 on 2017-02-05 18:40
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.10.5 on 2017-02-05 18:40
|
# Generated by Django 1.10.5 on 2017-02-05 18:40
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
import program.models
|
import program.models
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
# Generated by Django 1.10.5 on 2017-03-06 19:20
|
# Generated by Django 1.10.5 on 2017-03-06 19:20
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
# Generated by Django 1.10.5 on 2017-03-12 11:30
|
# Generated by Django 1.10.5 on 2017-03-12 11:30
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
import program.models
|
import program.models
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
# Generated by Django 1.10.5 on 2017-03-12 17:57
|
# Generated by Django 1.10.5 on 2017-03-12 17:57
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
import program.models
|
import program.models
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
import program.models
|
import program.models
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
import program.models
|
import program.models
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
# Generated by Django 1.11 on 2017-04-15 23:21
|
# Generated by Django 1.11 on 2017-04-15 23:21
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue