Skip to content

Instantly share code, notes, and snippets.

View zzgvh's full-sized avatar

Gabriel von Heijne zzgvh

  • Concinnity AB
  • Stockholm
View GitHub Profile
@zzgvh
zzgvh / restricted_user_projects_by_org.py
Created August 8, 2018 11:50
Alternative project access restriction model
class RestrictedUserProjectsByOrg(models.Model):
user = models.OneToOneField('User', related_name='restricted_projects')
organisation = models.ForeignKey('Organisation', related_name='restricted_users')
is_restricted = models.BooleanField(default=False) #do we need this?
restricted_projects = models.ManyToManyField(
'Project', related_name='inaccessible_by', null=True, blank=True)
"""
Descriptions of events and pseudo code. One question I haven't thought through is multiple employments
by both user and admin
from akvo.rsr.fields import ValidXMLCharField
from akvo.rsr.models import Transaction
class IATITransaction():
def __init__(self, transaction, iati_import, activity, project, activities_globals):
self.transaction = transaction
self.iati_import = iati_import
self.activity = activity
self.project = project
@zzgvh
zzgvh / dashboard.py
Last active August 29, 2015 14:27
Dashboard models
# -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from django.db import models
class Dashboard(models.Model):
@zzgvh
zzgvh / project_update_post
Created July 24, 2014 14:11
DRF based XML for project update
<root>
<locations>
<list-item>
<latitude>59.0</latitude>
<longitude>18.0</longitude>
<city>Stockholm</city>
<state>Stockholms län</state>
<country>18</country>
<address_1/>
<address_2/>
@zzgvh
zzgvh / gist:7008240
Created October 16, 2013 14:02
RAIN to RSR mapping of budget type
@rain:type @akvo:type Akvo label
==========================================
special case 1 other 1
special case 2 other 2
special case 3 other 3
??? 4 maintenance
employment 5 employment
??? 6 building material
training 7 training
management 8 management