Commit d8bbf5f8 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

private → public

parent cbd1e1a8
......@@ -112,7 +112,7 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(auto_now_add=True)),
('name', models.CharField(max_length=200, unique=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True)),
('private', models.BooleanField(default=False)),
('public', models.BooleanField(default=True)),
('homepage', models.URLField(blank=True, null=True)),
('description', models.TextField()),
('version', models.CharField(blank=True, max_length=20, null=True)),
......@@ -167,7 +167,7 @@ class Migration(migrations.Migration):
('maintainer', models.CharField(default='', max_length=200)),
('comment', models.TextField()),
('homepage', models.URLField(default='')),
('private', models.BooleanField(default=False)),
('public', models.BooleanField(default=True)),
('description', models.TextField()),
('updated', models.DateTimeField(blank=True, null=True)),
('license', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='rainboard.License')),
......
......@@ -149,7 +149,7 @@ class Forge(Links, NamedModel):
class Project(Links, NamedModel, TimeStampedModel):
private = models.BooleanField(default=False)
public = models.BooleanField(default=True)
main_namespace = models.ForeignKey(Namespace, on_delete=models.SET_NULL, null=True, blank=True)
main_forge = models.ForeignKey(Forge, on_delete=models.SET_NULL, null=True, blank=True)
license = models.ForeignKey(License, on_delete=models.SET_NULL, blank=True, null=True)
......@@ -520,7 +520,7 @@ class Robotpkg(NamedModel):
homepage = models.URLField(max_length=200, default='')
license = models.ForeignKey(License, on_delete=models.SET_NULL, blank=True, null=True)
private = models.BooleanField(default=False)
public = models.BooleanField(default=True)
description = models.TextField()
updated = models.DateTimeField(blank=True, null=True)
......@@ -552,7 +552,7 @@ class Robotpkg(NamedModel):
self.license = License.objects.get(spdx_id=RPKG_LICENSES[license])
else:
logger.warning(f'Unknown robotpkg license: {license}')
self.private = bool(check_output(['make', 'show-var', f'VARNAME=RESTRICTED'], cwd=cwd).decode().strip())
self.public = not bool(check_output(['make', 'show-var', f'VARNAME=RESTRICTED'], cwd=cwd).decode().strip())
with (cwd / 'DESCR').open() as f:
self.description = f.read().strip()
......@@ -610,9 +610,9 @@ def get_default_forge(project):
def update_gitlab(forge, data):
logger.info(f'update {data["name"]} from {forge}')
private = data['visibility'] in ['private', 'internal']
public = data['visibility'] not in ['private', 'internal']
project, created = Project.objects.get_or_create(name=data['name'],
defaults={'main_forge': forge, 'private': private})
defaults={'main_forge': forge, 'public': public})
namespace, _ = Namespace.objects.get_or_create(slug=data['namespace']['path'],
defaults={'name': data['namespace']['name']})
repo, _ = Repo.objects.get_or_create(forge=forge, namespace=namespace, project=project,
......
......@@ -37,7 +37,7 @@ class ProjectTable(StrippedTable):
class Meta:
model = models.Project
fields = ('main_namespace', 'name', 'license', 'homepage', 'updated', 'version')
fields = ('main_namespace', 'name', 'public', 'license', 'homepage', 'updated', 'version')
def render_name(self, record):
return record.get_link()
......
......@@ -13,10 +13,10 @@
{% bootstrap_label 'UNLICENSED' label_class='label label-warning' %}
{% endif %}
{% if project.private %}
{% bootstrap_label 'private' label_class='label label-danger' %}
{% else %}
{% if project.public %}
{% bootstrap_label 'public' label_class='label label-success' %}
{% else %}
{% bootstrap_label 'private' label_class='label label-danger' %}
{% endif %}
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment