Skip to content

Commit

Permalink
Add whole project
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-azevedo committed Jun 25, 2024
1 parent b039ea1 commit 021166c
Show file tree
Hide file tree
Showing 91 changed files with 2,433 additions and 312 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
2 changes: 0 additions & 2 deletions .streamlit/config.toml

This file was deleted.

6 changes: 0 additions & 6 deletions .vscode/settings.json

This file was deleted.

Binary file removed README.md
Binary file not shown.
File renamed without changes.
9 changes: 9 additions & 0 deletions accounts/admin.py
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)
6 changes: 6 additions & 0 deletions accounts/apps.py
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'
94 changes: 94 additions & 0 deletions accounts/forms.py
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": "",}
37 changes: 37 additions & 0 deletions accounts/migrations/0001_initial.py
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)),
],
),
]
17 changes: 17 additions & 0 deletions accounts/migrations/0002_remove_userinfo_genero.py
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',
),
]
21 changes: 21 additions & 0 deletions accounts/migrations/0003_alter_userinfo_style.py
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,
),
),
]
19 changes: 19 additions & 0 deletions accounts/migrations/0004_userinfo_likes.py
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.
56 changes: 56 additions & 0 deletions accounts/models.py
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')
Loading

0 comments on commit 021166c

Please sign in to comment.