def group_event_details(request, project, group, event_id): event = get_object_or_404(group.event_set, id=event_id) base_qs = group.event_set.exclude(id=event_id) try: next_event = base_qs.filter( datetime__gte=event.datetime).order_by('datetime')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter( datetime__lte=event.datetime).order_by('-datetime')[0:1].get() except Event.DoesNotExist: prev_event = None local_tz = getattr(django_settings, 'TIME_ZONE', 'UTC') return render_to_response( 'sentry/groups/event.html', { 'project': project, 'page': 'event', 'group': group, 'event': event, 'next_event': next_event, 'prev_event': prev_event, 'timezone': local_tz, 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'can_admin_event': can_admin_group(request.user, group), }, request)
def get_view_response(self, request, group): from sentry.models import Event from sentry.permissions import can_admin_group self.selected = request.path == self.get_url(group) if not self.selected: return response = self.view(request, group) if not response: return if isinstance(response, HttpResponseRedirect): return response if not isinstance(response, Response): raise NotImplementedError("Use self.render() when returning responses.") event = group.get_latest_event() or Event() event.group = group return response.respond( request, { "plugin": self, "project": group.project, "group": group, "event": event, "can_admin_event": can_admin_group(request.user, group), }, )
def group_event_details(request, project, group, event_id): event = get_object_or_404(group.event_set, id=event_id) base_qs = group.event_set.exclude(id=event_id) try: next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get() except Event.DoesNotExist: prev_event = None return render_to_response('sentry/groups/event.html', { 'project': project, 'page': 'event', 'group': group, 'event': event, 'next_event': next_event, 'prev_event': prev_event, 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'can_admin_event': can_admin_group(request.user, group), }, request)
def get_view_response(self, request, group): from sentry.permissions import can_admin_group self.selected = request.path == self.get_url(group) if not self.selected: return response = self.view(request, group) if not response: return if isinstance(response, HttpResponseRedirect): return response if not isinstance(response, Response): raise NotImplementedError('Please use self.render() when returning responses.') return response.respond(request, { 'plugin': self, 'project': group.project, 'group': group, 'can_admin_event': can_admin_group(request.user, group), })
def get_view_response(self, request, group): from sentry.models import Event from sentry.permissions import can_admin_group self.selected = request.path == self.get_url(group) if not self.selected: return response = self.view(request, group) if not response: return if isinstance(response, HttpResponseRedirect): return response if not isinstance(response, Response): raise NotImplementedError( 'Use self.render() when returning responses.') event = group.get_latest_event() or Event() event.group = group return response.respond( request, { 'plugin': self, 'project': group.project, 'group': group, 'event': event, 'can_admin_event': can_admin_group(request.user, group), })
def group_event_list(request, project, group): event_list = group.event_set.all().order_by('-datetime') return render_to_response('sentry/groups/event_list.html', { 'project': project, 'group': group, 'event_list': event_list, 'page': 'event_list', 'can_admin_event': can_admin_group(request.user, group), }, request)
def render_with_group_context(group, template, context, request=None, event=None, is_public=False): context.update({ 'team': group.project.team, 'organization': group.project.organization, 'project': group.project, 'group': group, 'can_admin_event': can_admin_group(request.user, group), 'can_remove_event': can_remove_group(request.user, group), }) if event: if event.id: # TODO(dcramer): we dont want to actually use gt/lt here as it should # be inclusive. However, that would need to ensure we have some kind # of way to know which event was the previous (an offset), or to add # a third sort key (which is not yet indexed) base_qs = group.event_set.exclude(id=event.id) try: next_event = base_qs.filter(datetime__gt=event.datetime, ).order_by('datetime')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter(datetime__lt=event.datetime, ).order_by('-datetime')[0:1].get() except Event.DoesNotExist: prev_event = None else: next_event = None prev_event = None if not is_public: extra_data = event.data.get('extra', {}) if not isinstance(extra_data, dict): extra_data = {} context.update({ 'tags': event.get_tags(), 'json_data': extra_data, }) context.update({ 'event': event, 'version_data': event.data.get('modules', None), 'next_event': next_event, 'prev_event': prev_event, }) return render_to_response(template, context, request)
def group_tag_details(request, project, group, tag_name): return render_to_response('sentry/plugins/bases/tag/index.html', { 'project': project, 'group': group, 'title': tag_name.replace('_', ' ').title(), 'tag_name': tag_name, 'unique_tags': group.get_unique_tags(tag_name), 'group': group, 'page': 'tag_details', 'can_admin_event': can_admin_group(request.user, group), }, request)
def group_tag_details(request, project, group, tag_name): return render_to_response( 'sentry/plugins/bases/tag/index.html', { 'project': project, 'group': group, 'title': tag_name.replace('_', ' ').title(), 'tag_name': tag_name, 'unique_tags': group.get_unique_tags(tag_name), 'group': group, 'page': 'tag_details', 'can_admin_event': can_admin_group(request.user, group), }, request)
def group_event_details(request, project, group, event_id): event = get_object_or_404(group.event_set, pk=event_id) return render_to_response('sentry/groups/event.html', { 'project': project, 'page': 'event', 'group': group, 'event': event, 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'can_admin_event': can_admin_group(request.user, group), }, request)
def render_with_group_context(group, template, context, request=None, event=None, is_public=False): context.update({ 'team': group.project.team, 'organization': group.project.organization, 'project': group.project, 'group': group, 'can_admin_event': can_admin_group(request.user, group), 'can_remove_event': can_remove_group(request.user, group), }) if event: if event.id: # TODO(dcramer): we dont want to actually use gt/lt here as it should # be inclusive. However, that would need to ensure we have some kind # of way to know which event was the previous (an offset), or to add # a third sort key (which is not yet indexed) base_qs = group.event_set.exclude(id=event.id) try: next_event = base_qs.filter( datetime__gt=event.datetime, ).order_by('datetime','id')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter( datetime__lt=event.datetime, ).order_by('-datetime','-id')[0:1].get() except Event.DoesNotExist: prev_event = None else: next_event = None prev_event = None if not is_public: extra_data = event.data.get('extra', {}) if not isinstance(extra_data, dict): extra_data = {} context.update({ 'tags': event.get_tags(), 'json_data': extra_data, }) context.update({ 'event': event, 'version_data': event.data.get('modules', None), 'next_event': next_event, 'prev_event': prev_event, }) return render_to_response(template, context, request)
def render_with_group_context(group, template, context, request=None, event=None, is_public=False): context.update({ 'team': group.project.team, 'project': group.project, 'group': group, 'can_admin_event': can_admin_group(request.user, group), 'can_remove_event': can_remove_group(request.user, group), }) if event: if event.id: base_qs = group.event_set.exclude(id=event.id) try: next_event = base_qs.filter(datetime__gte=event.datetime, pk__gte=event.pk).order_by( 'datetime', 'pk')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter(datetime__lte=event.datetime, pk__lte=event.pk).order_by( '-datetime', '-pk')[0:1].get() except Event.DoesNotExist: prev_event = None else: next_event = None prev_event = None if not is_public: extra_data = event.data.get('extra', {}) if not isinstance(extra_data, dict): extra_data = {} context.update({ 'tags': event.get_tags(), 'json_data': extra_data, }) context.update({ 'event': event, 'version_data': event.data.get('modules', None), 'next_event': next_event, 'prev_event': prev_event, }) return render_to_response(template, context, request)
def group_event_details(request, project, group, event_id): event = get_object_or_404(group.event_set, pk=event_id) return render_to_response('sentry/groups/event.html', { 'project': project, 'page': 'event_list', 'group': group, 'event': event, 'interface_list': _get_rendered_interfaces(event), 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'can_admin_event': can_admin_group(request.user, group), }, request)
def group_event_list(request, project, group): event_list = group.event_set.all().order_by("-datetime") return render_to_response( "sentry/groups/event_list.html", { "project": project, "group": group, "event_list": event_list, "page": "event_list", "can_admin_event": can_admin_group(request.user, group), }, request, )
def group_tag_details(request, project, group, tag_name): return render_to_response( "sentry/plugins/bases/tag/index.html", { "project": project, "group": group, "title": tag_name.replace("_", " ").title(), "tag_name": tag_name, "unique_tags": group.get_unique_tags(tag_name), "group": group, "page": "tag_details", "can_admin_event": can_admin_group(request.user, group), }, request, )
def group(request, project, group): # It's possible that a message would not be created under certain # circumstances (such as a post_save signal failing) event = group.get_latest_event() or Event(group=group) return render_to_response('sentry/groups/details.html', { 'project': project, 'page': 'details', 'group': group, 'event': event, 'interface_list': _get_rendered_interfaces(event), 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'can_admin_event': can_admin_group(request.user, group), }, request)
def render_with_group_context(group, template, context, request=None): # It's possible that a message would not be created under certain # circumstances (such as a post_save signal failing) event = group.get_latest_event() or Event() event.group = group context.update({ 'project': group.project, 'group': group, 'event': event, 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'can_admin_event': can_admin_group(request.user, group), }) return render_to_response(template, context, request)
def group_event_details(request, project, group, event_id): event = get_object_or_404(group.event_set, pk=event_id) return render_to_response( "sentry/groups/event.html", { "project": project, "page": "event_list", "group": group, "event": event, "interface_list": _get_rendered_interfaces(event), "json_data": event.data.get("extra", {}), "version_data": event.data.get("modules", None), "can_admin_event": can_admin_group(request.user, group), }, request, )
def render_with_group_context(group, template, context, request=None, event=None, is_public=False): context.update({ 'team': group.project.team, 'organization': group.project.organization, 'project': group.project, 'group': group, 'can_admin_event': can_admin_group(request.user, group), 'can_remove_event': can_remove_group(request.user, group), }) if event: if event.id: base_qs = group.event_set.exclude(id=event.id) try: next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get() except Event.DoesNotExist: prev_event = None else: next_event = None prev_event = None if not is_public: extra_data = event.data.get('extra', {}) if not isinstance(extra_data, dict): extra_data = {} context.update({ 'tags': event.get_tags(), 'json_data': extra_data, }) context.update({ 'event': event, 'version_data': event.data.get('modules', None), 'next_event': next_event, 'prev_event': prev_event, }) return render_to_response(template, context, request)
def render_with_group_context(group, template, context, request=None, event=None, is_public=False): context.update( { "team": group.project.team, "project": group.project, "group": group, "can_admin_event": can_admin_group(request.user, group), } ) if event: if event.id: base_qs = group.event_set.exclude(id=event.id) try: next_event = base_qs.filter(datetime__gte=event.datetime).order_by("datetime")[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter(datetime__lte=event.datetime).order_by("-datetime")[0:1].get() except Event.DoesNotExist: prev_event = None else: next_event = None prev_event = None if not is_public: extra_data = event.data.get("extra", {}) if not isinstance(extra_data, dict): extra_data = {} context.update({"tags": event.get_tags(), "json_data": extra_data}) context.update( { "event": event, "version_data": event.data.get("modules", None), "next_event": next_event, "prev_event": prev_event, } ) return render_to_response(template, context, request)
def group(request, project, group): # It's possible that a message would not be created under certain # circumstances (such as a post_save signal failing) event = group.get_latest_event() or Event(group=group) return render_to_response( "sentry/groups/details.html", { "project": project, "page": "details", "group": group, "event": event, "interface_list": _get_rendered_interfaces(event), "json_data": event.data.get("extra", {}), "version_data": event.data.get("modules", None), "can_admin_event": can_admin_group(request.user, group), }, request, )
def render_with_group_context(group, template, context, request=None, event=None): activity = Activity.objects.filter( group=group, ).order_by('-datetime').select_related('user') if event: activity = activity.filter(Q(event__isnull=True) | Q(event=event)) activity = list(activity) context.update({ 'team': group.project.team, 'project': group.project, 'group': group, 'can_admin_event': can_admin_group(request.user, group), 'SECTION': 'events', 'activity': activity, }) if event: if event.id: base_qs = group.event_set.exclude(id=event.id) try: next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get() except Event.DoesNotExist: next_event = None try: prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get() except Event.DoesNotExist: prev_event = None else: next_event = None prev_event = None context.update({ 'event': event, 'json_data': event.data.get('extra', {}), 'version_data': event.data.get('modules', None), 'next_event': next_event, 'prev_event': prev_event, }) return render_to_response(template, context, request)