Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purge: milestones + updates #6370

Merged
merged 6 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 268 additions & 1 deletion app/app/fixtures/grants.json

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions app/assets/v2/css/grants/detail.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,6 @@ textarea.editable {
padding-top: 0 !important;
}

.milestones-list li:last-child {
padding-bottom: 0 !important;
}

.disable-tooltip {
pointer-events: none;
}
Expand Down
143 changes: 0 additions & 143 deletions app/assets/v2/css/grants/milestones.css

This file was deleted.

38 changes: 0 additions & 38 deletions app/assets/v2/js/grants/milestones.js

This file was deleted.

2 changes: 0 additions & 2 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2079,8 +2079,6 @@ class Activity(SuperModel):
('new_grant_contribution', 'Contributed to Grant'),
('new_grant_subscription', 'Subscribed to Grant'),
('killed_grant_contribution', 'Cancelled Grant Contribution'),
('new_milestone', 'New Milestone'),
('update_milestone', 'Updated Milestone'),
('new_kudos', 'New Kudos'),
('created_kudos', 'Created Kudos'),
('receive_kudos', 'Receive Kudos'),
Expand Down
19 changes: 1 addition & 18 deletions app/grants/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
from django.utils.html import format_html
from django.utils.safestring import mark_safe

from grants.models import (
CLRMatch, Contribution, Flag, Grant, MatchPledge, Milestone, PhantomFunding, Subscription, Update,
)
from grants.models import CLRMatch, Contribution, Flag, Grant, MatchPledge, PhantomFunding, Subscription


class GeneralAdmin(admin.ModelAdmin):
Expand Down Expand Up @@ -255,19 +253,6 @@ def etherscan_links(self, instance):
html += f"<a href='https://etherscan.io/tx/{instance.split_tx_id}' target=new>SPLITTXID: {instance.split_tx_id}</a>"
return mark_safe(html)

class MilestoneAdmin(admin.ModelAdmin):
"""Define the Milestone administration layout."""

ordering = ['-id']
list_display =['pk', 'grant', 'title', 'created_on']


class UpdateAdmin(admin.ModelAdmin):
"""Define the Update administration layout."""

ordering = ['-id']
list_display =['pk', 'grant', 'title', 'created_on']


class PhantomFundingAdmin(admin.ModelAdmin):
"""Define the GeneralAdmin administration layout."""
Expand Down Expand Up @@ -295,5 +280,3 @@ def from_ip_address(self, instance):
admin.site.register(CLRMatch, GeneralAdmin)
admin.site.register(Subscription, SubscriptionAdmin)
admin.site.register(Contribution, ContributionAdmin)
admin.site.register(Milestone, MilestoneAdmin)
admin.site.register(Update, UpdateAdmin)
31 changes: 1 addition & 30 deletions app/grants/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django import forms
from django.utils.translation import gettext_lazy as _

from grants.models import Grant, Milestone
from grants.models import Grant


class GrantForm(forms.ModelForm):
Expand All @@ -35,32 +35,3 @@ class Meta:
'cancel_tx_id', 'amount_received', 'token_address', 'contract_address', 'metadata', 'network',
'required_gas_price', 'admin_profile', 'team_members'
)


class MilestoneForm(forms.ModelForm):
"""Define the Milestone form logic."""

class Meta:
"""Define the metadata for the Milestone model form."""

model = Milestone
fields = ('title', 'description', 'due_date', )
widgets = {
'title': forms.TextInput(attrs={
'class': 'form__input form__input-lg',
'placeholder': _('Title')
}),
'description':
forms.Textarea(attrs={
'class': 'form__input form__input-lg',
'placeholder': _('Description')
}),
'due_date':
forms.TextInput(
attrs={
'type': 'text',
'class': 'form__input form__input-lg',
'placeholder': _('Due Date for completion')
}
)
}
59 changes: 0 additions & 59 deletions app/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,65 +461,6 @@ def contract(self):
return grant_contract


class Milestone(SuperModel):
"""Define the structure of a Grant Milestone"""

title = models.CharField(max_length=255, help_text=_('The Milestone title.'))
description = models.TextField(help_text=_('The Milestone description.'))
due_date = models.DateField(help_text=_('The requested Milestone completion date.'))
completion_date = models.DateField(
default=None,
blank=True,
null=True,
help_text=_('The Milestone completion date.'),
)
grant = models.ForeignKey(
'Grant',
related_name='milestones',
on_delete=models.CASCADE,
null=True,
help_text=_('The associated Grant.'),
)

def __str__(self):
"""Return the string representation of a Milestone."""
return (
f" id: {self.pk}, title: {self.title}, description: {self.description}, "
f"due_date: {self.due_date}, completion_date: {self.completion_date}, grant: {self.grant_id}"
)


class UpdateQuerySet(models.QuerySet):
"""Define the Update default queryset and manager."""

pass


class Update(SuperModel):
"""Define the structure of a Grant Update."""
title = models.CharField(
default='',
max_length=255,
help_text=_('The title of the Grant.')
)
description = models.TextField(
default='',
blank=True,
help_text=_('The description of the Grant.')
)
grant = models.ForeignKey(
'grants.Grant',
related_name='updates',
on_delete=models.CASCADE,
null=True,
help_text=_('The associated Grant.'),
)

def __str__(self):
"""Return the string representation of this object."""
return self.title


class SubscriptionQuerySet(models.QuerySet):
"""Define the Subscription default queryset and manager."""

Expand Down
15 changes: 2 additions & 13 deletions app/grants/serializers.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
from dashboard.router import ProfileSerializer
from rest_framework import serializers

from .models import Contribution, Grant, Milestone, Subscription


class MilestoneSerializer(serializers.ModelSerializer):
"""Handle serializing the Milestone object."""

class Meta:
"""Define the milestone serializer metadata."""

model = Milestone
fields = ('title', 'description', 'due_date', 'completion_date')
from .models import Contribution, Grant, Subscription


class GrantSerializer(serializers.ModelSerializer):
"""Handle serializing the Grant object."""

admin_profile = ProfileSerializer()
team_members = ProfileSerializer(many=True)
milestones = MilestoneSerializer(many=True)

class Meta:
"""Define the grant serializer metadata."""
Expand All @@ -28,7 +17,7 @@ class Meta:
fields = (
'active', 'title', 'slug', 'description', 'reference_url', 'logo', 'admin_address', 'amount_goal',
'amount_received', 'token_address', 'token_symbol', 'contract_address', 'metadata',
'network', 'required_gas_price', 'admin_profile', 'team_members', 'percentage_done', 'milestones',
'network', 'required_gas_price', 'admin_profile', 'team_members', 'percentage_done',
)


Expand Down
Loading