-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
839c797
commit 61c959a
Showing
8 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from django.contrib import admin | ||
|
||
from base_site.brokes_note.models import Broker | ||
from base_site.brokes_note.models import BrokersNote | ||
from base_site.brokes_note.models import BrokersNoteItem | ||
from base_site.brokes_note.models import Company | ||
|
||
|
||
class BrokerAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
class CompanyAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
class BrokersNoteItemInline(admin.TabularInline): | ||
model = BrokersNoteItem | ||
|
||
|
||
class BrokersNoteAdmin(admin.ModelAdmin): | ||
|
||
inlines = [ | ||
BrokersNoteItemInline, | ||
] | ||
|
||
|
||
class BrokersNoteItemAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
"note", | ||
"company", | ||
"unit", | ||
"value", | ||
) | ||
|
||
|
||
admin.site.register(Broker, BrokerAdmin) | ||
admin.site.register(Company, CompanyAdmin) | ||
admin.site.register(BrokersNote, BrokersNoteAdmin) | ||
admin.site.register(BrokersNoteItem, BrokersNoteItemAdmin) | ||
|
||
# list_display = ( | ||
# "db_included_date_time", | ||
# "category", | ||
# "name", | ||
# "description", | ||
# "debit", | ||
# "credit", | ||
# "payment_date_time", | ||
# "create_date_time", | ||
# ) | ||
# readonly_fields = ("db_included_date_time",) | ||
# list_filter = ("category", "name", "type_entry", "payment_date_time", "create_date_time") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class BrokesNoteConfig(AppConfig): | ||
name = "base_site.brokes_note" |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from django.db import models | ||
|
||
|
||
class Broker(models.Model): | ||
name = models.CharField(max_length=70) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
|
||
class Company(models.Model): | ||
name = models.CharField(max_length=300) | ||
paper = models.CharField(max_length=20) | ||
|
||
def __str__(self): | ||
return self.paper | ||
|
||
|
||
class BrokersNote(models.Model): | ||
date = models.DateField() | ||
broker = models.ForeignKey(Broker, on_delete=models.CASCADE) | ||
number = models.CharField(max_length=30) | ||
link = models.URLField() | ||
brokerage_fee = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
settlement_fee = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
Emonuments_fee = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
irrf = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
final_value = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
|
||
def __str__(self): | ||
return self.date.strftime("%d/%m/%Y") | ||
|
||
class Meta: | ||
unique_together = [["broker", "number"]] | ||
|
||
|
||
class BrokersNoteItem(models.Model): | ||
note = models.ForeignKey(BrokersNote, on_delete=models.CASCADE) | ||
company = models.ForeignKey(Company, on_delete=models.CASCADE) | ||
unit = models.IntegerField() | ||
buy_or_sell = models.CharField(max_length=1) | ||
credit_or_debit = models.CharField(max_length=1) | ||
value = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
total_value = models.DecimalField(max_digits=9, decimal_places=2, default=0) | ||
|
||
def __str__(self): | ||
return self.company.paper |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains 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