<commit_before>import os

from django.core.files.storage import FileSystemStorage
from django.db import models
from django.contrib.auth.models import User

import tagging
from tagging.fields import TagField

from pytask.taskapp.utilities.helper import get_key

GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
RIGHTS_CHOICES = (
	("AD", "Admin"),
	("MG", "Manager"),
	("DV", "Developer"),
	("CT", "Contributor"),)

STATUS_CHOICES = (
    ("UP", "Unpublished"),
    ("OP", "Open"),
    ("LO", "Locked"),
    ("WR", "Working"),
    ("CD", "Closed"),
    ("DL", "Deleted"),
    ("CM", "Completed"))

NOTIFY_CHOICES = (
    ("MT", "Add Mentor"),
    ("DV", "Developer"),
    ("MG", "Manager"),
    ("AD", "Admin"),
    ("PY", "Assign credits"),
    ("CM", "Task completed"),
    ("CD", "Task closed"),
    ("DL", "Task deleted"),
    ("NU", "New User"),
    ("NT", "New Mentor"),
    ("ND", "New Developer"),
    ("NG", "New Manager"),
    ("NA", "New Admin"),
    ("AU", "Assign user"), ## i mean assign the task
    ("RU", "Remove user"), ## remove from working users list in task
)

IMAGES_DIR = "./images"
UPLOADS_DIR = "./uploads"

class CustomImageStorage(FileSystemStorage):

    def path(self, name):
        """ we return images directory path.
        """

        return os.path.join(IMAGES_DIR, name)

    def get_available_name(self, name):
        """ here we are going with username as the name of image.
        """
    
        root, ext = os.path.splitext(name)
        file_name = get_key() + ext
        while self.exists(file_name):
            file_name = get_key() + ext
        return file_name

class Profile(models.Model):
    
    user = models.ForeignKey(User, unique = True)
    dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD")
    gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
    rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    credits = models.PositiveSmallIntegerField(default = 0)
    
    aboutme = models.TextField(blank = True)
    foss_comm = TagField(verbose_name="FOSS Communities")
    phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number")
    homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog")
    street = models.CharField(max_length = 80, blank = True)
    city = models.CharField(max_length = 25, blank = True)
    country = models.CharField(max_length = 25, blank = True)
    nick = models.CharField(max_length = 20, blank = True)
    photo = models.ImageField(storage = CustomImageStorage(),upload_to = IMAGES_DIR, blank = True)

    def __unicode__(self):
        return unicode(self.user.username)

class Task(models.Model):
    
    prim_key = models.AutoField(primary_key = True)
    id = models.CharField(max_length = 10, unique = True)
    title = models.CharField(max_length = 100, verbose_name = u"Title", help_text = u"Keep it simple and below 100 chars.")
    desc = models.TextField(verbose_name = u"Description")
    status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
    tags_field = TagField(verbose_name = u"Tags") 
    
    credits = models.PositiveSmallIntegerField()
    progress = models.PositiveSmallIntegerField(default = 0)
        
    mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors")
    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
    claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users")
    assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users")
    
    creation_datetime = models.DateTimeField()
    published_datetime = models.DateTimeField()
    sub_type = models.CharField(max_length=1, choices = (('D','Dependency'),('S','Subtask')), default = 'D')   
    
    def __unicode__(self):<commit_msg>added help text in models.py<commit_after>import os

from django.core.files.storage import FileSystemStorage
from django.db import models
from django.contrib.auth.models import User

import tagging
from tagging.fields import TagField

from pytask.taskapp.utilities.helper import get_key

GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
RIGHTS_CHOICES = (
	("AD", "Admin"),
	("MG", "Manager"),
	("DV", "Developer"),
	("CT", "Contributor"),)

STATUS_CHOICES = (
    ("UP", "Unpublished"),
    ("OP", "Open"),
    ("LO", "Locked"),
    ("WR", "Working"),
    ("CD", "Closed"),
    ("DL", "Deleted"),
    ("CM", "Completed"))

NOTIFY_CHOICES = (
    ("MT", "Add Mentor"),
    ("DV", "Developer"),
    ("MG", "Manager"),
    ("AD", "Admin"),
    ("PY", "Assign credits"),
    ("CM", "Task completed"),
    ("CD", "Task closed"),
    ("DL", "Task deleted"),
    ("NU", "New User"),
    ("NT", "New Mentor"),
    ("ND", "New Developer"),
    ("NG", "New Manager"),
    ("NA", "New Admin"),
    ("AU", "Assign user"), ## i mean assign the task
    ("RU", "Remove user"), ## remove from working users list in task
)

IMAGES_DIR = "./images"
UPLOADS_DIR = "./uploads"

class CustomImageStorage(FileSystemStorage):

    def path(self, name):
        """ we return images directory path.
        """

        return os.path.join(IMAGES_DIR, name)

    def get_available_name(self, name):
        """ here we are going with username as the name of image.
        """
    
        root, ext = os.path.splitext(name)
        file_name = get_key() + ext
        while self.exists(file_name):
            file_name = get_key() + ext
        return file_name

class Profile(models.Model):
    
    user = models.ForeignKey(User, unique = True)
    dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD")
    gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
    rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    credits = models.PositiveSmallIntegerField(default = 0)
    
    aboutme = models.TextField(blank = True)
    foss_comm = TagField(verbose_name="FOSS Communities")
    phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number")
    homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog")
    street = models.CharField(max_length = 80, blank = True)
    city = models.CharField(max_length = 25, blank = True)
    country = models.CharField(max_length = 25, blank = True)
    nick = models.CharField(max_length = 20, blank = True)
    photo = models.ImageField(storage = CustomImageStorage(),upload_to = IMAGES_DIR, blank = True)

    def __unicode__(self):
        return unicode(self.user.username)

class Task(models.Model):
    
    prim_key = models.AutoField(primary_key = True)
    id = models.CharField(max_length = 10, unique = True)
    title = models.CharField(max_length = 100, verbose_name = u"Title", help_text = u"Keep it simple and below 100 chars.")
    desc = models.TextField(verbose_name = u"Description")
    status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
    tags_field = TagField(verbose_name = u"Tags", help_text = u"Give comma seperated tags") 
    
    credits = models.PositiveSmallIntegerField(help_text = u"No.of credits a user gets on completing the task")
    progress = models.PositiveSmallIntegerField(default = 0)
        
    mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors")
    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
    claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users")
    assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users")
    
    creation_datetime = models.DateTimeField()
    published_datetime = models.DateTimeField()
    sub_type = models.CharField(max_length=1, choices = (('D','Dependency'),('S','Subtask')), default = 'D')   
    
    def __unicode__(self):
{'fraction_non_alphanumeric': 0.1480503144654088, 'fraction_numerical': 0.0060377358490566035, 'mean_word_length': 3.7075192421551213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2438339', 'n_tokens_mistral': 2618, 'n_tokens_neox': 2495, 'n_words': 621}