Unverified Commit 1aefda82 authored by David Haynes's avatar David Haynes 🙆
Browse files

feat: Include __future__ imports for 2.7 backwards compt



- If the file is run in py2, it should still function if using certain
py3 functionality (unicode, division, imports, etc)
Signed-off-by: David Haynes's avatarDavid Haynes <dhaynes3@gmu.edu>
parent 07a01d93
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Django Imports
from django.contrib import admin from django.contrib import admin
# App Imports
from .models import Facility, Schedule, OpenTime, Category from .models import Facility, Schedule, OpenTime, Category
class OpenTimeInline(admin.TabularInline): class OpenTimeInline(admin.TabularInline):
......
from models import Facility # Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python stdlib Imports
import re import re
# App Imports
from .models import Facility
def export_data(): def export_data():
facilities = list() facilities = list()
......
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python stdlib Imports
import datetime
# Django Imports
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from autoslug import AutoSlugField from autoslug import AutoSlugField
import datetime
class Category(TimeStampedModel): class Category(TimeStampedModel):
name = models.CharField(max_length=100) name = models.CharField(max_length=100)
......
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# App Imports
from .models import Category, Facility, Schedule, OpenTime
# Other Imports
from rest_framework import serializers from rest_framework import serializers
from website.models import Category, Facility, Schedule, OpenTime
class CategorySerializer(serializers.ModelSerializer): class CategorySerializer(serializers.ModelSerializer):
class Meta: class Meta:
......
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Django Imports # Django Imports
from django.conf.urls import include, url from django.conf.urls import include, url
......
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python stdlib Imports
import hashlib
import json
# Django Imports
from django.template import RequestContext from django.template import RequestContext
from website.models import Facility, OpenTime
from website.api import export_data
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.http import HttpResponse from django.http import HttpResponse
from django.views.decorators.http import condition from django.views.decorators.http import condition
from django.views.generic import ListView, DetailView from django.views.generic import ListView, DetailView
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from website.models import Facility, OpenTime, Category, Schedule # App Imports
from website.api import export_data from .models import Facility, OpenTime, Category, Schedule
from website.serializers import CategorySerializer, FacilitySerializer, ScheduleSerializer, OpenTimeSerializer from .api import export_data
from .serializers import CategorySerializer, FacilitySerializer, ScheduleSerializer, OpenTimeSerializer
# Other Imports
from rest_framework import viewsets, status from rest_framework import viewsets, status
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
import hashlib
import json
# Rest Framework Class Views # Rest Framework Class Views
class CategoryViewSet(viewsets.ReadOnlyModelViewSet): class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Category.objects.all() queryset = Category.objects.all()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment