This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Category(models.Model): | |
| categoryNumber = models.CharField(max_length=3, verbose_name="항목번호") | |
| item = models.CharField(max_length=40, verbose_name="항목") | |
| description = models.TextField(blank=True, verbose_name="메모") | |
| class Member(models.Model): | |
| name = models.CharField(max_length=10, verbose_name="이름") | |
| birthday = models.DateField(verbose_name="생일",) | |
| phone = models.CharField(max_length=11, verbose_name="전화번호", default="'-'기호 빼고 입력") | |
| email = models.EmailField(verbose_name="Email",blank=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x = [1,2,3,4,5] | |
| y = ['a','b','c','d','e','f'] | |
| {% for i in x %} | |
| <tr> | |
| {% for j in y %} | |
| <td>{{ i }},{{ j }}</td> | |
| {% endfor %} | |
| </tr> | |
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def searched_day(request): | |
| today = datetime.datetime.now() | |
| if 'sdate' in request.POST and request.POST['sdate']: | |
| sdate = request.POST['sdate'] | |
| date_etc = M_etc.objects.filter(date=sdate) | |
| ... | |
| ... | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Out1(models.Model): | |
| money = models.IntegerField(verbose_name=META_NAME[1]) | |
| date = models.DateField(verbose_name='집행일') | |
| executor = models.ForeignKey(Executor, verbose_name='집행자') | |
| comment = models.TextField(blank=True, verbose_name='메모') | |
| week = models.IntegerField(blank=True) | |
| def save(self, *args, **kwargs): | |
| if not self.week: | |
| self.week = self.date.isocalendar()[1] | |
| return super(Out1, self).save(*args, **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. <input type="date" name="date" /> | |
| 2. views.py | |
| def search(request): | |
| today = datetime.datetime.now() | |
| if 'date' in request.POST and request.POST['date']: | |
| date = request.POST['date'] | |
| date_sallary = Sallary.objects.filter(date=today.date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| class Member(models.Model): | |
| name = models.CharField(max_length=30, verbose_name='name') | |
| email = models.EmailField(verbose_name='email', blank=True) | |
| birth = models.DateField(verbose_name='birthday', blank=True) | |
| rdate = models.DateField(verbose_name='reg.date') | |
| def __unicode__(self): | |
| return self.name | |
| class Meta: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def report(request): | |
| today = datetime.datetime.now() | |
| executor = Executor.objects.all() | |
| budgets = {'management_budgets': ['out1', 'out2', 'out3', 'out4'], | |
| 'education_budgets': ['out5', 'out6', 'out7'], | |
| 'feed_budgets': ['out8', 'out9', 'out10', 'out11', 'out12', 'out13'], | |
| 'reward_budgets': ['out14', 'out15', 'out16'], | |
| 'mission_budgets': ['out17', 'out18', 'out19', 'out20', 'out21'], | |
| 'operation_budgets': ['out22', 'out23', 'out24', 'out25']} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def report(request): | |
| today = datetime.datetime.now() | |
| executor = Executor.objects.all() | |
| queryset = Budget.objects.filter(year=today.year) | |
| aggregates = {} | |
| for i in xrange(1, 25+1): | |
| aggregates['out%d' % i] = models.Sum('out%d' % i) | |
| budget = queryset.aggregate(**aggregates) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| li = [] | |
| for i in range(1,26): | |
| li.append(x[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def report(request): | |
| today = datetime.datetime.now() | |
| executor = Executor.objects.all() | |
| budget_out1 = sum(Budget.objects.filter(year=today.year).values_list("out1", flat=True)) | |
| budget_out2 = sum(Budget.objects.filter(year=today.year).values_list("out2", flat=True)) | |
| budget_out3 = sum(Budget.objects.filter(year=today.year).values_list("out3", flat=True)) | |
| budget_out4 = sum(Budget.objects.filter(year=today.year).values_list("out4", flat=True)) | |
| budget_out5 = sum(Budget.objects.filter(year=today.year).values_list("out5", flat=True)) | |
| budget_out6 = sum(Budget.objects.filter(year=today.year).values_list("out6", flat=True)) |