<commit_before>from django.core.management.base import BaseCommand
from xbrowse_server.base.models import Project
import sys
from django.conf import settings

class Command(BaseCommand):

    def add_arguments(self, parser):
        parser.add_argument('args', nargs='+')

    def handle(self, *args, **options):
        if len(args)<1 or not args[0]:
          print '\n\n'
          print 'Creates a project in xBrowse.\n'
          print 'Please provide a project ID as an argument. Optionally, provide a more human-readable project name as a second argument. '
          print 'Example: python manage.py add_project 1kg\n'
          sys.exit()

        project_id = args[0]
        if "." in project_id:
            sys.exit("ERROR: A '.' in the project ID is not supported")

        if Project.objects.filter(project_id=project_id).exists():
            print '\nSorry, I am unable to create that project since it exists already\n'
            sys.exit()
        
        if len(args) > 1:
            project_name = args[1]
            print('Creating project with id: %(project_id)s with name: %(project_name)s' % locals())
        else: 
            sys.exit("ERROR: Please provide 2 args: the project_id and the project_name")


        try:
            Project.objects.create(project_id=project_id, project_name=project_name)
        except Exception as e:
          print('\nError creating project:', e, '\n')<commit_msg>Save 'created_date'<commit_after>from django.core.management.base import BaseCommand
from xbrowse_server.base.models import Project
import sys
from django.conf import settings
from django.utils import timezone

class Command(BaseCommand):

    def add_arguments(self, parser):
        parser.add_argument('args', nargs='+')

    def handle(self, *args, **options):
        if len(args)<1 or not args[0]:
          print '\n\n'
          print 'Creates a project in xBrowse.\n'
          print 'Please provide a project ID as an argument. Optionally, provide a more human-readable project name as a second argument. '
          print 'Example: python manage.py add_project 1kg\n'
          sys.exit()

        project_id = args[0]
        if "." in project_id:
            sys.exit("ERROR: A '.' in the project ID is not supported")

        if Project.objects.filter(project_id=project_id).exists():
            print '\nSorry, I am unable to create that project since it exists already\n'
            sys.exit()
        
        if len(args) > 1:
            project_name = args[1]
            print('Creating project with id: %(project_id)s with name: %(project_name)s' % locals())
        else: 
            sys.exit("ERROR: Please provide 2 args: the project_id and the project_name")


        try:
            Project.objects.create(project_id=project_id, project_name=project_name, created_date=timezone.now())
        except Exception as e:
          print('\nError creating project:', e, '\n')
{'fraction_non_alphanumeric': 0.10153321976149915, 'fraction_numerical': 0.004770017035775128, 'mean_word_length': 2.5416164053075994, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5896795', 'n_tokens_mistral': 841, 'n_tokens_neox': 812, 'n_words': 269}