mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
expung imagekit and clean import lists
This commit is contained in:
parent
6cc578435c
commit
cb4128436c
@ -1,22 +0,0 @@
|
||||
from imagekit.specs import ImageSpec
|
||||
from imagekit import processors
|
||||
|
||||
class ResizeThumb(processors.Resize):
|
||||
width = 100
|
||||
crop = False
|
||||
|
||||
class ResizeDisplay(processors.Resize):
|
||||
width = 600
|
||||
|
||||
#class EnhanceThumb(processors.Adjustment):
|
||||
#contrast = 1.2
|
||||
#sharpness = 2
|
||||
|
||||
class Thumbnail(ImageSpec):
|
||||
access_as = 'thumbnail_image'
|
||||
pre_cache = True
|
||||
processors = [ResizeThumb]
|
||||
|
||||
class Display(ImageSpec):
|
||||
increment_count = True
|
||||
processors = [ResizeDisplay]
|
@ -148,7 +148,7 @@ class Person(TroggleModel):
|
||||
return "%s %s" % (self.first_name, self.last_name)
|
||||
return self.first_name
|
||||
|
||||
|
||||
|
||||
def notability(self):
|
||||
notability = Decimal(0)
|
||||
max_expo_val = 0
|
||||
@ -172,15 +172,6 @@ class Person(TroggleModel):
|
||||
return self.personexpedition_set.order_by('-expedition')[0]
|
||||
def last(self):
|
||||
return self.personexpedition_set.order_by('expedition')[0]
|
||||
|
||||
#def Sethref(self):
|
||||
#if self.last_name:
|
||||
#self.href = self.first_name.lower() + "_" + self.last_name.lower()
|
||||
#self.orderref = self.last_name + " " + self.first_name
|
||||
#else:
|
||||
# self.href = self.first_name.lower()
|
||||
#self.orderref = self.first_name
|
||||
#self.notability = 0.0 # set temporarily
|
||||
|
||||
class PersonExpedition(TroggleModel):
|
||||
"""Person's attendance to one Expo
|
||||
@ -412,12 +403,10 @@ class Cave(TroggleModel):
|
||||
url = models.CharField(max_length=200,blank=True,null=True)
|
||||
filename = models.CharField(max_length=200)
|
||||
|
||||
|
||||
#class Meta:
|
||||
# unique_together = (("area", "kataster_number"), ("area", "unofficial_number"))
|
||||
# FIXME Kataster Areas and CUCC defined sub areas need seperating
|
||||
|
||||
|
||||
#href = models.CharField(max_length=100)
|
||||
|
||||
class Meta:
|
||||
@ -791,33 +780,6 @@ class QM(TroggleModel):
|
||||
def wiki_link(self):
|
||||
return "%s%s%s" % ('[[QM:',self.code(),']]')
|
||||
|
||||
#photoFileStorage = FileSystemStorage(location=settings.PHOTOS_ROOT, base_url=settings.PHOTOS_URL)
|
||||
#class DPhoto(TroggleImageModel):
|
||||
#caption = models.CharField(max_length=1000,blank=True,null=True)
|
||||
#contains_logbookentry = models.ForeignKey(LogbookEntry,blank=True,null=True)
|
||||
#contains_person = models.ManyToManyField(Person,blank=True,null=True)
|
||||
# replace link to copied file with link to original file location
|
||||
#file = models.ImageField(storage=photoFileStorage, upload_to='.',)
|
||||
#is_mugshot = models.BooleanField(default=False)
|
||||
#contains_cave = models.ForeignKey(Cave,blank=True,null=True)
|
||||
#contains_entrance = models.ForeignKey(Entrance, related_name="photo_file",blank=True,null=True)
|
||||
#nearest_survey_point = models.ForeignKey(SurveyStation,blank=True,null=True)
|
||||
#nearest_QM = models.ForeignKey(QM,blank=True,null=True)
|
||||
#lon_utm = models.FloatField(blank=True,null=True)
|
||||
#lat_utm = models.FloatField(blank=True,null=True)
|
||||
|
||||
# class IKOptions:
|
||||
# spec_module = 'core.imagekit_specs'
|
||||
# cache_dir = 'thumbs'
|
||||
# image_field = 'file'
|
||||
|
||||
#content_type = models.ForeignKey(ContentType)
|
||||
#object_id = models.PositiveIntegerField()
|
||||
#location = generic.GenericForeignKey('content_type', 'object_id')
|
||||
|
||||
# def __str__(self):
|
||||
# return self.caption
|
||||
|
||||
scansFileStorage = FileSystemStorage(location=settings.SURVEY_SCANS, base_url=settings.SURVEYS_URL)
|
||||
def get_scan_path(instance, filename):
|
||||
year=instance.survey.expedition.year
|
||||
@ -837,10 +799,6 @@ class ScannedImage(TroggleImageModel):
|
||||
lon_utm = models.FloatField(blank=True,null=True)
|
||||
lat_utm = models.FloatField(blank=True,null=True)
|
||||
|
||||
class IKOptions:
|
||||
spec_module = 'core.imagekit_specs'
|
||||
cache_dir = 'thumbs'
|
||||
image_field = 'file'
|
||||
#content_type = models.ForeignKey(ContentType)
|
||||
#object_id = models.PositiveIntegerField()
|
||||
#location = generic.GenericForeignKey('content_type', 'object_id')
|
||||
|
@ -45,5 +45,4 @@ def _resolves(url):
|
||||
resolve(url)
|
||||
return True
|
||||
except http.Http404:
|
||||
return False
|
||||
|
||||
return False
|
@ -1,11 +1,13 @@
|
||||
'''
|
||||
This module is the part of troggle that parses descriptions of cave parts (subcaves) from the legacy html files and saves them in the troggle database as instances of the model Subcave. Unfortunately, this parser can not be very flexible because the legacy format is poorly structured.
|
||||
'''
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
|
||||
import sys, os
|
||||
|
||||
import os, re, logging
|
||||
from django.conf import settings
|
||||
|
||||
from troggle.core.models import Subcave, Cave
|
||||
from utils import save_carefully
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
from .settings import *
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
import django
|
||||
|
||||
from .settings import *
|
||||
|
||||
pathsdict={
|
||||
"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX,
|
||||
"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX,
|
||||
@ -57,4 +59,3 @@ for p in bycodes:
|
||||
byvals = sorted(pathsdict, key=pathsdict.__getitem__)
|
||||
for p in byvals:
|
||||
print(pathsdict[p] , sep2, p)
|
||||
|
10
urls.py
10
urls.py
@ -1,15 +1,15 @@
|
||||
from django.conf.urls import *
|
||||
from django.conf import settings
|
||||
from django.conf.urls import *
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.views.generic.list import ListView
|
||||
from django.contrib import admin
|
||||
|
||||
from .core.views import * # flat import
|
||||
from .core.views_other import *
|
||||
from .core.views_caves import *
|
||||
from .core.views_survex import *
|
||||
from .core.models import *
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.contrib import admin
|
||||
from django.views.generic.list import ListView
|
||||
from django.contrib import admin
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
|
||||
|
9
utils.py
9
utils.py
@ -1,6 +1,9 @@
|
||||
import random
|
||||
import re
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.shortcuts import render
|
||||
import random, re, logging
|
||||
from troggle.core.models import CaveDescription
|
||||
|
||||
def weighted_choice(lst):
|
||||
@ -159,6 +162,4 @@ def html_to_wiki(text, codec = "utf-8"):
|
||||
#substitutions
|
||||
for regex, repl in re_subs:
|
||||
out = regex.sub(repl, out)
|
||||
return out
|
||||
|
||||
|
||||
return out
|
Loading…
Reference in New Issue
Block a user