23 lines
749 B
Python
23 lines
749 B
Python
from re import T
|
|
from django.db import models
|
|
|
|
# Create your models here.
|
|
|
|
|
|
class GithubCrawler(models.Model):
|
|
url = models.CharField(max_length=1000,blank = False)
|
|
api_url = models.CharField(max_length=1000, null= True, blank=True)
|
|
last_pushed = models.DateField(null= True,blank=True)
|
|
last_pushed_number = models.IntegerField(null= True,blank=True)
|
|
def __str__(self):
|
|
return self.url
|
|
|
|
def save(self, *args, **kwargs):
|
|
check_len = len(self.url)
|
|
if self.url[check_len-1] == "/":
|
|
self.api_url = self.url + 'commits/master'
|
|
else:
|
|
self.api_url = self.url + '/commits/master'
|
|
super(GithubCrawler, self).save(*args, **kwargs)
|
|
|
|
# Research , via Chrome dev tools ;)
|