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

clone_url

parent 9fce739d
# Generated by Django 2.0.1 on 2018-01-12 10:31 # Generated by Django 2.0.1 on 2018-01-12 18:05
import autoslug.fields import autoslug.fields
from django.conf import settings from django.conf import settings
...@@ -128,6 +128,7 @@ class Migration(migrations.Migration): ...@@ -128,6 +128,7 @@ class Migration(migrations.Migration):
('open_pr', models.PositiveSmallIntegerField(blank=True, null=True)), ('open_pr', models.PositiveSmallIntegerField(blank=True, null=True)),
('repo_id', models.PositiveIntegerField()), ('repo_id', models.PositiveIntegerField()),
('forked_from', models.PositiveIntegerField(blank=True, null=True)), ('forked_from', models.PositiveIntegerField(blank=True, null=True)),
('clone_url', models.URLField(blank=True, null=True)),
('forge', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rainboard.Forge')), ('forge', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rainboard.Forge')),
('license', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='rainboard.License')), ('license', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='rainboard.License')),
('namespace', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rainboard.Namespace')), ('namespace', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rainboard.Namespace')),
......
...@@ -168,6 +168,7 @@ class Repo(TimeStampedModel): ...@@ -168,6 +168,7 @@ class Repo(TimeStampedModel):
open_pr = models.PositiveSmallIntegerField(blank=True, null=True) open_pr = models.PositiveSmallIntegerField(blank=True, null=True)
repo_id = models.PositiveIntegerField() repo_id = models.PositiveIntegerField()
forked_from = models.PositiveIntegerField(blank=True, null=True) forked_from = models.PositiveIntegerField(blank=True, null=True)
clone_url = models.URLField(max_length=200, blank=True, null=True)
# TODO gitlab: # TODO gitlab:
# description = models.TextField() # description = models.TextField()
# created_at = models.DateTimeField() # created_at = models.DateTimeField()
...@@ -206,6 +207,7 @@ class Repo(TimeStampedModel): ...@@ -206,6 +207,7 @@ class Repo(TimeStampedModel):
self.default_branch = data['default_branch'] self.default_branch = data['default_branch']
if 'forked_from_project' in data: if 'forked_from_project' in data:
self.forked_from = data['forked_from_project']['id'] self.forked_from = data['forked_from_project']['id']
self.clone_url = data['http_url_to_repo']
self.save() self.save()
def api_update_github(self, data): def api_update_github(self, data):
...@@ -220,6 +222,8 @@ class Repo(TimeStampedModel): ...@@ -220,6 +222,8 @@ class Repo(TimeStampedModel):
self.repo_id = data['id'] self.repo_id = data['id']
if 'source' in data: if 'source' in data:
self.forked_from = data['source']['id'] self.forked_from = data['source']['id']
self.clone_url = data['clone_url']
self.save()
class Commit(NamedModel, TimeStampedModel): class Commit(NamedModel, TimeStampedModel):
......
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