<commit_before>from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models import User

#1. Problems: id,title, statement, output, uploadedby
#2. Admins: id, name, email, passwordhash
#3. Students: id, name, email, passwordhash
@python_2_unicode_compatible
class Problem(models.Model):
    problem_id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=50,unique=False)
    statement = models.TextField(max_length=3000,unique=False)
    uploadedby = models.ForeignKey(User,verbose_name="problem-setter")
    def __str__(self):
        return "{} : {}".format(self.problem_id,self.title)
    class Meta:
        verbose_name='problem'
        ordering = ['problem_id']
<commit_msg>django-model: Limit choice to only staff members to select as problem setter for a problem<commit_after>from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models import User

#1. Problems: id,title, statement, output, uploadedby
#2. Admins: id, name, email, passwordhash
#3. Students: id, name, email, passwordhash
@python_2_unicode_compatible
class Problem(models.Model):
    problem_id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=50,unique=False)
    statement = models.TextField(max_length=3000,unique=False)
    uploadedby = models.ForeignKey(User,verbose_name="problem-setter",limit_choices_to={'is_staff': True})
    def __str__(self):
        return "{} : {}".format(self.problem_id,self.title)
    class Meta:
        verbose_name='problem'
        ordering = ['problem_id']

{'fraction_non_alphanumeric': 0.10976349302607641, 'fraction_numerical': 0.013341419041843541, 'mean_word_length': 5.226415094339623, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6479960', 'n_tokens_mistral': 521, 'n_tokens_neox': 492, 'n_words': 115}