-
Notifications
You must be signed in to change notification settings - Fork 0
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
b039ea1
commit 021166c
Showing
91 changed files
with
2,433 additions
and
312 deletions.
There are no files selected for viewing
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 @@ | ||
*.pyc |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,9 @@ | ||
from django.contrib import admin | ||
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from .models import UserInfo | ||
|
||
|
||
# Register your models here. | ||
admin.site.register(UserInfo) |
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AccountsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'accounts' |
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,94 @@ | ||
from django import forms | ||
from django.forms import EmailInput | ||
from django.contrib.auth.forms import AuthenticationForm, UsernameField, UserCreationForm | ||
from django.contrib.auth import password_validation | ||
from django.contrib.auth.models import User, Group | ||
import datetime | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
class LoginForm(AuthenticationForm): | ||
username = UsernameField( | ||
label="", | ||
widget=forms.TextInput(attrs={ | ||
"autofocus": True, | ||
"placeholder": "Nome de usuário"})) | ||
password = forms.CharField( | ||
label="", | ||
strip=False, | ||
widget=forms.PasswordInput(attrs={ | ||
"autocomplete": "Senha atual", | ||
"placeholder": "Palavra-chave"}), | ||
) | ||
|
||
class CreateUserForm(UserCreationForm): | ||
password1 = forms.CharField( | ||
label="", | ||
strip=False, | ||
widget=forms.PasswordInput(attrs={ | ||
"autocomplete": "Palavra-chave", | ||
"placeholder": "Palavra-chave" | ||
}), | ||
help_text=password_validation.password_validators_help_text_html(), | ||
) | ||
password2 = forms.CharField( | ||
label="", | ||
widget=forms.PasswordInput(attrs={ | ||
"autocomplete": "new-password", | ||
"placeholder": "Confirmar palavra-chave" | ||
}), | ||
strip=False, | ||
help_text=_("Enter the same password as before, for verification."), | ||
) | ||
|
||
email = forms.EmailField( | ||
required=True, | ||
widget=EmailInput(attrs={'placeholder': "Endereço de email"}), | ||
label="") | ||
|
||
gender_choices = [ | ||
('F', 'Feminino'), | ||
('M', 'Masculino'), | ||
('O', 'Outro'), | ||
] | ||
gender = forms.ChoiceField(choices=gender_choices, widget=forms.RadioSelect()) | ||
name = forms.CharField( | ||
max_length=100, | ||
label="Nome completo", | ||
widget=forms.TextInput(attrs={"placeholder": "Digite seu nome",}) | ||
) | ||
|
||
crr_year = datetime.date.today().year | ||
years = list(range(crr_year, crr_year-100, -1)) | ||
birthday = forms.DateField(widget=forms.SelectDateWidget(years=years), label="Aniversário") | ||
|
||
size_choices = [ | ||
('P', 'Pequeno'), | ||
('M', 'Médio'), | ||
('G', 'Grande'), | ||
] | ||
size = forms.ChoiceField(choices=size_choices, widget=forms.RadioSelect()) | ||
|
||
|
||
style_choices = [ | ||
('BA', 'Básico'), | ||
('MO', 'Moderninho'), | ||
('EL', 'Elegante'), | ||
] | ||
style = forms.ChoiceField(choices=style_choices, widget=forms.RadioSelect()) | ||
|
||
interests_choices = [ | ||
('roupas', 'Roupas'), | ||
('fitness', 'Fitness'), | ||
('beleza', 'Beleza'), | ||
('eletronicos', 'Eletrônicos'), | ||
('outros', 'Outros') | ||
] | ||
interests = forms.MultipleChoiceField(choices=interests_choices, widget=forms.CheckboxSelectMultiple()) | ||
class Meta: | ||
model = User | ||
fields = ("username","email") | ||
field_classes = {"username": UsernameField} | ||
widgets = { | ||
"username": forms.TextInput(attrs={"placeholder": "Nome de usuário",}), | ||
} | ||
labels = {"username": "",} |
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,37 @@ | ||
# Generated by Django 5.0.6 on 2024-06-18 22:58 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='UserInfo', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100)), | ||
('birthday', models.DateField()), | ||
('genero', models.CharField(max_length=8)), | ||
('created_date', models.DateTimeField(auto_now_add=True)), | ||
('gender', models.CharField(choices=[('F', 'Feminino'), ('M', 'Masculino'), ('O', 'Outro')], max_length=1)), | ||
('size', models.CharField(choices=[('P', 'Pequeno'), ('M', 'Médio'), ('G', 'Grande')], max_length=1)), | ||
('style', models.CharField(choices=[('P', 'Pequeno'), ('M', 'Médio'), ('G', 'Grande')], max_length=2)), | ||
('roupas', models.IntegerField()), | ||
('fitness', models.IntegerField()), | ||
('beleza', models.IntegerField()), | ||
('eletronicos', models.IntegerField()), | ||
('outros', models.IntegerField()), | ||
('friends', models.ManyToManyField(blank=True, to='accounts.userinfo')), | ||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user_info', to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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,17 @@ | ||
# Generated by Django 5.0.6 on 2024-06-19 02:07 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='userinfo', | ||
name='genero', | ||
), | ||
] |
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,21 @@ | ||
# Generated by Django 5.0.6 on 2024-06-20 23:36 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("accounts", "0002_remove_userinfo_genero"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="userinfo", | ||
name="style", | ||
field=models.CharField( | ||
choices=[("BA", "Básico"), ("MO", "Moderninho"), ("EL", "Elegante")], | ||
max_length=2, | ||
), | ||
), | ||
] |
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,19 @@ | ||
# Generated by Django 5.0.6 on 2024-06-22 20:43 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("accounts", "0003_alter_userinfo_style"), | ||
("gifts", "0006_remove_gift_likes"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="userinfo", | ||
name="likes", | ||
field=models.ManyToManyField(blank=True, to="gifts.gift"), | ||
), | ||
] |
File renamed without changes.
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,56 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
from django.contrib.auth.models import User | ||
from gifts.models import Gift | ||
|
||
class UserInfo(models.Model): | ||
|
||
user = models.OneToOneField( | ||
User, on_delete=models.CASCADE, related_name="user_info") | ||
name = models.CharField(max_length=100) | ||
birthday = models.DateField() | ||
created_date = models.DateTimeField(auto_now_add=True) | ||
|
||
gender_choices = [ | ||
('F', 'Feminino'), | ||
('M', 'Masculino'), | ||
('O', 'Outro'), | ||
] | ||
gender = models.CharField( | ||
max_length=1, | ||
choices=gender_choices | ||
) | ||
|
||
size_choices = [ | ||
('P', 'Pequeno'), | ||
('M', 'Médio'), | ||
('G', 'Grande'), | ||
] | ||
size = models.CharField( | ||
max_length=1, | ||
choices=size_choices | ||
) | ||
|
||
style_choices = [ | ||
('BA', 'Básico'), | ||
('MO', 'Moderninho'), | ||
('EL', 'Elegante'), | ||
] | ||
style = models.CharField( | ||
max_length=2, | ||
choices=style_choices | ||
) | ||
roupas = models.IntegerField() | ||
fitness = models.IntegerField() | ||
beleza = models.IntegerField() | ||
eletronicos = models.IntegerField() | ||
outros = models.IntegerField() | ||
|
||
friends = models.ManyToManyField("UserInfo", blank = True) | ||
|
||
likes = models.ManyToManyField(Gift, blank=True) | ||
def __str__(self): | ||
return self.user.username + str(' info') |
Oops, something went wrong.