Changeset - b7e2ce2a4d44
[Not reviewed]
0 31 0
Ben Sturmfels (bsturmfels) - 7 months ago 2023-10-19 22:45:53
ben@sturm.com.au
Switch to relative imports

The relative imports make it clearer what code is within the project and where
it's coming from.
31 files changed with 131 insertions and 84 deletions:
0 comments (0 inline, 0 general)
www/conservancy/__init__.py
Show inline comments
...
 
@@ -4,6 +4,2 @@ from django.conf import settings
 

	
 
# This is backwards compatibilty support for a custom function we wrote
 
# ourselves that is no longer necessary in modern Django.
 
from django.shortcuts import render as render_template_with_context
 

	
 

	
www/conservancy/apps/assignment/migrations/0004_auto_20230127_0602.py
Show inline comments
...
 
@@ -2,5 +2,4 @@
 

	
 
import conservancy.apps.assignment.models
 
from django.db import migrations, models
 

	
 
from ..models import validate_mutiple_urls
 

	
...
 
@@ -26,3 +25,3 @@ class Migration(migrations.Migration):
 
            name='repositories',
 
            field=models.TextField(help_text='List of URLs, one per line', validators=[conservancy.apps.assignment.models.validate_mutiple_urls], verbose_name='Code repositories containing contributions of yours whose copyright you are assigning'),
 
            field=models.TextField(help_text='List of URLs, one per line', validators=[validate_mutiple_urls], verbose_name='Code repositories containing contributions of yours whose copyright you are assigning'),
 
        ),
www/conservancy/apps/blog/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.blog.models import EntryTag, Entry
 

	
 
from .models import EntryTag, Entry
 

	
 

	
...
 
@@ -8,2 +10,3 @@ admin.site.register(EntryTag, EntryTagAdmin)
 

	
 

	
 
class EntryAdmin(admin.ModelAdmin):
www/conservancy/apps/blog/models.py
Show inline comments
 
from datetime import datetime, timedelta
 

	
 
from django.db import models
 
from django.conf import settings
 
from conservancy import bsoup
 
from conservancy.apps.staff.models import Person
 
from datetime import datetime, timedelta
 

	
 
from ... import bsoup
 
from ..staff.models import Person
 

	
 

	
www/conservancy/apps/blog/urls.py
Show inline comments
 
from django.conf.urls import url, include
 
from conservancy.apps.blog.models import Entry, EntryTag # relative import
 
from conservancy.apps.staff.models import Person
 
from datetime import datetime
 
from conservancy.apps.blog.views import last_name, BlogYearArchiveView, BlogMonthArchiveView, BlogDayArchiveView, BlogDateDetailView, custom_index, query
 

	
 
from django.conf.urls import url, include
 

	
 
from .models import Entry, EntryTag
 
from ..staff.models import Person
 
from .views import last_name, BlogYearArchiveView, BlogMonthArchiveView, BlogDayArchiveView, BlogDateDetailView, custom_index, query
 

	
www/conservancy/apps/blog/views.py
Show inline comments
 
from conservancy.apps.blog.models import Entry, EntryTag # relative import
 
# from django.views.generic.list_detail import object_list
 
from datetime import datetime
 
from functools import reduce
 

	
 
from django.views.generic import ListView
...
 
@@ -5,6 +6,7 @@ from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArc
 
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
 
from conservancy.apps.staff.models import Person
 
from django.shortcuts import get_object_or_404, render
 
from datetime import datetime
 
from functools import reduce
 

	
 
from .models import Entry, EntryTag
 
from ..staff.models import Person
 

	
 

	
www/conservancy/apps/contacts/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.contacts.models import ContactEntry
 

	
 
from .models import ContactEntry
 

	
 

	
www/conservancy/apps/contacts/views.py
Show inline comments
...
 
@@ -2,5 +2,7 @@ from django.shortcuts import render
 
from django import forms
 
from conservancy.apps.contacts.models import ContactEntry
 
from django.forms import ModelForm
 

	
 
from .models import ContactEntry
 

	
 

	
 
def subscribe(request):
www/conservancy/apps/contractpatch/urls.py
Show inline comments
 
from django.conf.urls import url, include
 
from conservancy.apps.contractpatch import views as cpatch_views
 

	
 
from . import views as cpatch_views
 

	
www/conservancy/apps/contractpatch/views.py
Show inline comments
 
from conservancy import render_template_with_context
 
from conservancy.apps.blog.models import Entry as BlogEntry
 
from datetime import datetime
 

	
 
from django.shortcuts import render
 

	
 
from ..blog.models import Entry
 

	
 

	
 
def index(request):
...
 
@@ -10,4 +13,4 @@ def index(request):
 
    context = {
 
        'blog_entries': BlogEntry.objects.filter(**filters)[:3],
 
        'blog_entries': Entry.objects.filter(**filters)[:3],
 
    }
 
    return render_template_with_context(request, "contractpatch/index.html", context)
 
    return render(request, "contractpatch/index.html", context)
www/conservancy/apps/events/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.events.models import EventTag, Event, EventMedia
 

	
 
from .models import EventTag, Event, EventMedia
 

	
www/conservancy/apps/events/models.py
Show inline comments
 
from django.db import models
 
from conservancy.apps.staff.models import Person
 
from conservancy.apps.worldmap.models import EarthLocation
 
from datetime import datetime, timedelta
 

	
 
from django.db import models
 

	
 
from ..staff.models import Person
 
from ..worldmap.models import EarthLocation
 

	
 

	
 
class EventTag(models.Model):
www/conservancy/apps/events/urls.py
Show inline comments
 
from django.conf.urls import patterns, url, include
 
from conservancy.apps.events.models import Event
 

	
 
from .models import Event
 

	
www/conservancy/apps/events/views.py
Show inline comments
...
 
@@ -5,5 +5,5 @@ from django.template import loader
 
from django.core.exceptions import ObjectDoesNotExist
 
from conservancy.apps.events.models import Event
 
# for debugging...
 
from django.http import HttpResponse
 

	
 
from .models import Event
 

	
 

	
www/conservancy/apps/fundgoal/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.fundgoal import models as fundgoal_models
 

	
 
from . import models
 

	
 

	
...
 
@@ -6,2 +8,3 @@ class FundraisingGoalAdmin(admin.ModelAdmin):
 

	
 

	
 
class GoalProviderAdmin(admin.ModelAdmin):
...
 
@@ -12,3 +15,3 @@ class GoalProviderAdmin(admin.ModelAdmin):
 

	
 
admin.site.register(fundgoal_models.FundraisingGoal, FundraisingGoalAdmin)
 
admin.site.register(fundgoal_models.GoalProvider, GoalProviderAdmin)
 
admin.site.register(models.FundraisingGoal, FundraisingGoalAdmin)
 
admin.site.register(models.GoalProvider, GoalProviderAdmin)
www/conservancy/apps/fundgoal/views.py
Show inline comments
 
from conservancy.apps.fundgoal.models import FundraisingGoal
 
from django.http import JsonResponse
 

	
 
from .models import FundraisingGoal
 

	
 

	
...
 
@@ -22,2 +23,2 @@ def view(request):
 

	
 
    return JsonResponse( returnDict)
 
    return JsonResponse(returnDict)
www/conservancy/apps/news/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.news.models import PressRelease, ExternalArticleTag, ExternalArticle
 

	
 
from .models import PressRelease, ExternalArticleTag, ExternalArticle
 

	
 

	
www/conservancy/apps/news/models.py
Show inline comments
 
from datetime import datetime, timedelta
 

	
 
from django.db import models
 
from django.conf import settings
 
from conservancy import bsoup
 
from conservancy.apps.staff.models import Person
 
from conservancy.apps.events.models import Event
 
from django.contrib.sites.models import Site
 
from datetime import datetime, timedelta
 

	
 
from ... import bsoup
 
from ..staff.models import Person
 
from ..events.models import Event
 

	
 

	
www/conservancy/apps/news/urls.py
Show inline comments
...
 
@@ -21,4 +21,5 @@ from django.conf.urls import url, include
 
from django.conf import settings
 
from conservancy.apps.news.models import PressRelease, ExternalArticle
 
from conservancy.apps.news.views import NewsYearArchiveView, NewsMonthArchiveView, NewsDayArchiveView, NewsDateDetailView, listing
 

	
 
from .models import PressRelease, ExternalArticle
 
from .views import NewsYearArchiveView, NewsMonthArchiveView, NewsDayArchiveView, NewsDateDetailView, listing
 

	
www/conservancy/apps/news/views.py
Show inline comments
 
# from django.views.generic.list_detail import object_list
 
from datetime import datetime
 

	
 
from django.views.generic import ListView
...
 
@@ -5,9 +6,8 @@ from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArc
 
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
 
from conservancy.apps.news.models import ExternalArticle
 
from conservancy.apps.news.models import PressRelease
 
from conservancy.apps.events.models import Event
 
from datetime import datetime
 
# for debugging...
 
from django.http import HttpResponse
 

	
 
from .models import ExternalArticle
 
from .models import PressRelease
 
from ..events.models import Event
 

	
 

	
www/conservancy/apps/staff/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.staff.models import Person
 

	
 
from .models import Person
 

	
 

	
www/conservancy/apps/summit_registration/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.summit_registration.models import SummitRegistration
 

	
 
from .models import SummitRegistration
 

	
 

	
www/conservancy/apps/supporter/urls.py
Show inline comments
...
 
@@ -2,4 +2,5 @@ from django.conf.urls import url
 
from django.views.generic import TemplateView
 
from conservancy.apps.supporter import views as supp_views
 
from conservancy.static import views as static_views
 

	
 
from . import views as supp_views
 
from ...static import views as static_views
 

	
www/conservancy/apps/supporter/views.py
Show inline comments
 
from django.shortcuts import render
 

	
 
import conservancy
 

	
 

	
 
def index(request):
...
 
@@ -15,2 +18,2 @@ def index(request):
 
    }
 
    return conservancy.render_template_with_context(request, "supporter/index.html", context)
 
    return render(request, "supporter/index.html", context)
www/conservancy/apps/supporters/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.supporters.models import Supporter
 

	
 
from .models import Supporter
 

	
 

	
www/conservancy/apps/worldmap/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.worldmap.models import EarthLocation
 

	
 
from .models import EarthLocation
 

	
 

	
www/conservancy/feeds.py
Show inline comments
 
from django.contrib.syndication.views import Feed
 
from django.utils.feedgenerator import Rss201rev2Feed 
 
from conservancy.apps.news.models import PressRelease
 
from conservancy.apps.blog.models import Entry as BlogEntry
 
from django.shortcuts import render
 
from django.conf import settings
 
from datetime import datetime
 

	
 
from functools import reduce
 
import itertools
 
import operator
 
from functools import reduce
 

	
 
from django.conf import settings
 
from django.contrib.syndication.views import Feed
 
from django.shortcuts import render
 
from django.utils.feedgenerator import Rss201rev2Feed
 

	
 
from .apps.blog.models import Entry as BlogEntry
 
from .apps.news.models import PressRelease
 

	
 

	
www/conservancy/frontpage.py
Show inline comments
 
from conservancy import render_template_with_context
 
from conservancy.apps.supporters.models import Supporter as Supporter
 
from conservancy.apps.news.models import PressRelease
 
from conservancy.apps.blog.models import Entry as BlogEntry
 
from datetime import datetime
 

	
 
from django.shortcuts import render
 

	
 
from .apps.blog.models import Entry
 
from .apps.news.models import PressRelease
 
from .apps.supporters.models import Supporter
 

	
 

	
 
def view(request):
...
 
@@ -11,3 +14,2 @@ def view(request):
 
    """
 

	
 
    now = datetime.now()
...
 
@@ -16,4 +18,4 @@ def view(request):
 
        'supporters_count': Supporter.objects.all().filter(display_until_date__gte=now).count(),
 
        'blog': BlogEntry.objects.all().filter(pub_date__lte=now)[:5],
 
        'blog': Entry.objects.all().filter(pub_date__lte=now)[:5],
 
    }
 
    return render_template_with_context(request, "frontpage.html", context)
 
    return render(request, "frontpage.html", context)
www/conservancy/local_context_processors.py
Show inline comments
...
 
@@ -2,4 +2,4 @@ from datetime import datetime as DateTime
 

	
 
import conservancy.settings
 
from conservancy.apps.fundgoal.models import FundraisingGoal as FundraisingGoal
 
from . import settings
 
from .apps.fundgoal.models import FundraisingGoal
 

	
...
 
@@ -20,4 +20,4 @@ def sitefundraiser(request):
 

	
 
if conservancy.settings.FORCE_CANONICAL_HOSTNAME:
 
    _HOST_URL_VAR = {'host_url': 'https://' + conservancy.settings.FORCE_CANONICAL_HOSTNAME}
 
if settings.FORCE_CANONICAL_HOSTNAME:
 
    _HOST_URL_VAR = {'host_url': 'https://' + settings.FORCE_CANONICAL_HOSTNAME}
 
    def host_url(request):
www/conservancy/sponsors.py
Show inline comments
 
from django.shortcuts import render
 
from conservancy.apps.supporters.models import Supporter as Supporter
 
from datetime import datetime, timedelta
 

	
 
from django.shortcuts import render
 

	
 
from .apps.supporters.models import Supporter
 

	
 

	
 
def view(request):
www/conservancy/urls.py
Show inline comments
...
 
@@ -22,5 +22,5 @@ from django.contrib import admin
 

	
 
from conservancy import feeds, frontpage, sponsors
 
import conservancy.apps.fundgoal.views as fundgoal_views
 
import conservancy.static.views as static_views
 
from . import feeds, frontpage, sponsors
 
from .apps.fundgoal import views as fundgoal_views
 
from .static import views as static_views
 

	
0 comments (0 inline, 0 general)