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

[WIP] Remote projects #6858

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions pootle/apps/pootle_remote/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.

default_app_config = 'pootle_remote.apps.PootleRemoteConfig'
32 changes: 32 additions & 0 deletions pootle/apps/pootle_remote/abstracts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

from django.db import models

from pootle_language.models import Language


class AbstractRemoteSite(models.Model):
url = models.URLField()
type = models.CharField(max_length=32)
sync_frequency = models.IntegerField()
last_sync = models.DateTimeField()
update_frequency = models.IntegerField()

class Meta(object):
abstract = True


class AbstractRemoteProject(models.Model):
code = models.CharField(
db_index=True,
max_length=255,
null=False,
blank=False)
fullname = models.CharField(
db_index=True,
max_length=255,
null=False,
blank=False)
languages = models.ManyToManyField(Language)

class Meta(object):
abstract = True
20 changes: 20 additions & 0 deletions pootle/apps/pootle_remote/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.

import importlib

from django.apps import AppConfig


class PootleRemoteConfig(AppConfig):
name = "pootle_remote"
verbose_name = "Pootle Remote"
version = "0.0.1"

def ready(self):
importlib.import_module("pootle_remote.models")
49 changes: 49 additions & 0 deletions pootle/apps/pootle_remote/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-16 19:41
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('pootle_language', '0003_ensure_unique_special_chars'),
]

operations = [
migrations.CreateModel(
name='RemoteProject',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(db_index=True, max_length=255)),
('fullname', models.CharField(db_index=True, max_length=255)),
('languages', models.ManyToManyField(to='pootle_language.Language')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='RemoteSite',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField()),
('type', models.CharField(max_length=32)),
('sync_frequency', models.IntegerField()),
('last_sync', models.DateTimeField()),
('update_frequency', models.IntegerField()),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='remoteproject',
name='site',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pootle_remote.RemoteSite'),
),
]
Empty file.
19 changes: 19 additions & 0 deletions pootle/apps/pootle_remote/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.

from django.db import models

from .abstracts import AbstractRemoteProject, AbstractRemoteSite


class RemoteSite(AbstractRemoteSite):
pass


class RemoteProject(AbstractRemoteProject):
site = models.ForeignKey(RemoteSite)
1 change: 1 addition & 0 deletions pootle/settings/50-project.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ INSTALLED_APPS = [
'pootle_profile',
'pootle_data',
'pootle_revision',
'pootle_remote',
'pootle_score',
'pootle_statistics',
'pootle_terminology',
Expand Down