# Path: open_connect/accounts/views.py
# class SignupView(AllauthSignupView):
#     """Connect Signup View"""
#     form_class = SignupForm
# 
# Path: open_connect/groups/views.py
# class GroupListView(CommonViewMixin, ListView):
#     """View for listing groups."""
#     model = Group
#     located = False
#     template_name = "groups/group_list.html"
#     context_object_name = 'groups'
#     nav_active_item = 'Groups'
#     dd_active_item = 'My Groups'
# 
#     def get_queryset(self):
#         """Modify queryset if there are search params in the request."""
#         location = self.request.GET.get('location')
#         query = self.request.GET.get('q')
#         coords = None
# 
#         if location:
#             coords = get_coordinates(location)
# 
#         if coords:
#             self.located = True
# 
#         queryset = Group.objects.search(
#             search=query, location=coords)
# 
#         return queryset
# 
#     def get_context_data(self, **kwargs):
#         """Group list view context object populator"""
#         context = super(GroupListView, self).get_context_data(**kwargs)
# 
#         context['q'] = self.request.GET.get('q', '')
#         context['categories'] = Category.objects.filter(
#             # Because we use `queryset.extra(select=,where=)` and the `where=`
#             # explictly mentions "group_groups" we cannot include that query as
#             # part of the query that gets our categories.
#             pk__in=list(self.object_list.values_list(
#                 'category_id', flat=True)))
#         context['location'] = self.request.GET.get('location')
#         context['located'] = self.located
# 
#         if self.request.user.is_authenticated():
#             user = self.request.user
#             requested_ids = GroupRequest.objects.filter(
#                 user=user, approved__isnull=True).values_list(
#                     'group_id', flat=True)
#             subscribed_ids = user.groups_joined.values_list('pk', flat=True)
#             moderating_ids = user.groups_moderating.values_list(
#                 'id', flat=True)
#         else:
#             requested_ids = []
#             subscribed_ids = []
#             moderating_ids = []
# 
#         context['requested_ids'] = requested_ids
#         context['subscribed_ids'] = subscribed_ids
#         context['moderating_ids'] = moderating_ids
# 
#         return context


from urlparse import urljoin
from allauth.account import views as auth_views
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.http import HttpResponse
from django.views.generic import RedirectView, TemplateView
from django_bouncy.views import endpoint as bouncy_endpoint
from open_connect.accounts.views import SignupView as ConnectSignupView
from open_connect.groups.views import GroupListView
import autocomplete_light
"""Connect base url definitions."""
# pylint: disable=no-value-for-parameter,invalid-name



autocomplete_light.autodiscover()
admin.autodiscover()


urlpatterns = patterns(
    '',
    url(r'^$', include('open_connect.welcome.urls')),
    url(r'^admin/', include(admin.site.urls)),

    # Because we're overriding django-allauth's signup view with our own view
    # we need to include it above the include for django-allatuh
    url(r'^user/signup/$',

# Path: open_connect/accounts/views.py
# class SignupView(AllauthSignupView):
#     """Connect Signup View"""
#     form_class = SignupForm
# 
# Path: open_connect/groups/views.py
# class GroupListView(CommonViewMixin, ListView):
#     """View for listing groups."""
#     model = Group
#     located = False
#     template_name = "groups/group_list.html"
#     context_object_name = 'groups'
#     nav_active_item = 'Groups'
#     dd_active_item = 'My Groups'
# 
#     def get_queryset(self):
#         """Modify queryset if there are search params in the request."""
#         location = self.request.GET.get('location')
#         query = self.request.GET.get('q')
#         coords = None
# 
#         if location:
#             coords = get_coordinates(location)
# 
#         if coords:
#             self.located = True
# 
#         queryset = Group.objects.search(
#             search=query, location=coords)
# 
#         return queryset
# 
#     def get_context_data(self, **kwargs):
#         """Group list view context object populator"""
#         context = super(GroupListView, self).get_context_data(**kwargs)
# 
#         context['q'] = self.request.GET.get('q', '')
#         context['categories'] = Category.objects.filter(
#             # Because we use `queryset.extra(select=,where=)` and the `where=`
#             # explictly mentions "group_groups" we cannot include that query as
#             # part of the query that gets our categories.
#             pk__in=list(self.object_list.values_list(
#                 'category_id', flat=True)))
#         context['location'] = self.request.GET.get('location')
#         context['located'] = self.located
# 
#         if self.request.user.is_authenticated():
#             user = self.request.user
#             requested_ids = GroupRequest.objects.filter(
#                 user=user, approved__isnull=True).values_list(
#                     'group_id', flat=True)
#             subscribed_ids = user.groups_joined.values_list('pk', flat=True)
#             moderating_ids = user.groups_moderating.values_list(
#                 'id', flat=True)
#         else:
#             requested_ids = []
#             subscribed_ids = []
#             moderating_ids = []
# 
#         context['requested_ids'] = requested_ids
#         context['subscribed_ids'] = subscribed_ids
#         context['moderating_ids'] = moderating_ids
# 
#         return context


# Path: connect/urls.py
from urlparse import urljoin
from allauth.account import views as auth_views
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.http import HttpResponse
from django.views.generic import RedirectView, TemplateView
from django_bouncy.views import endpoint as bouncy_endpoint
from open_connect.accounts.views import SignupView as ConnectSignupView
from open_connect.groups.views import GroupListView
import autocomplete_light

"""Connect base url definitions."""
# pylint: disable=no-value-for-parameter,invalid-name



autocomplete_light.autodiscover()
admin.autodiscover()


urlpatterns = patterns(
    '',
    url(r'^$', include('open_connect.welcome.urls')),
    url(r'^admin/', include(admin.site.urls)),

    # Because we're overriding django-allauth's signup view with our own view
    # we need to include it above the include for django-allatuh
    url(r'^user/signup/$',

        ConnectSignupView.as_view(),