diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 5be02db..a3f1ff5 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..83ba4de 100644 --- a/config/settings.py +++ b/config/settings.py @@ -58,6 +58,8 @@ INSTALLED_APPS = [ 'core', ] +AUTH_USER_MODEL = 'core.User' + MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/cookies.txt b/cookies.txt new file mode 100644 index 0000000..4133569 --- /dev/null +++ b/cookies.txt @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +127.0.0.1 FALSE / TRUE 1796991812 csrftoken cXuPVQPkN93dgAsbLP1e8OsLOYhW3Mkl diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..1e76241 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..d1f8e91 Binary files /dev/null and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..9335191 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1f807fa..3a67afd 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 6867ddf..cdb0bc9 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..d3dfb73 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin +from .models import User, Profile, SocialProfile -# Register your models here. +admin.site.register(User) +admin.site.register(Profile) +admin.site.register(SocialProfile) diff --git a/core/forms.py b/core/forms.py new file mode 100644 index 0000000..f4ce4f5 --- /dev/null +++ b/core/forms.py @@ -0,0 +1,29 @@ +from django import forms +from django.contrib.auth.forms import UserCreationForm +from .models import User, Profile + +class CompanySignUpForm(UserCreationForm): + class Meta(UserCreationForm.Meta): + model = User + fields = ('username', 'email') + + def save(self, commit=True): + user = super().save(commit=False) + user.role = User.Role.COMPANY + if commit: + user.save() + Profile.objects.create(user=user) + return user + +class InfluencerSignUpForm(UserCreationForm): + class Meta(UserCreationForm.Meta): + model = User + fields = ('username', 'email') + + def save(self, commit=True): + user = super().save(commit=False) + user.role = User.Role.INFLUENCER + if commit: + user.save() + Profile.objects.create(user=user) + return user diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..65701c9 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,34 @@ +# Generated by Django 5.2.7 on 2025-12-12 12:06 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Influencer', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('bio', models.TextField()), + ('profile_picture', models.ImageField(blank=True, null=True, upload_to='influencer_profile_pictures/')), + ], + ), + migrations.CreateModel( + name='Profile', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('platform', models.CharField(max_length=255)), + ('handle', models.CharField(max_length=255)), + ('url', models.URLField()), + ('influencer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='profiles', to='core.influencer')), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..590cb84 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..7101d43 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,26 @@ +from django.contrib.auth.models import AbstractUser from django.db import models -# Create your models here. +class User(AbstractUser): + class Role(models.TextChoices): + COMPANY = "COMPANY", "Company" + INFLUENCER = "INFLUENCER", "Influencer" + + role = models.CharField(max_length=50, choices=Role.choices) + +class Profile(models.Model): + user = models.OneToOneField(User, on_delete=models.CASCADE) + bio = models.TextField(blank=True) + profile_picture = models.ImageField(upload_to='profile_pictures/', blank=True, null=True) + + def __str__(self): + return self.user.username + +class SocialProfile(models.Model): + profile = models.ForeignKey(Profile, on_delete=models.CASCADE, related_name='social_profiles') + platform = models.CharField(max_length=255) + handle = models.CharField(max_length=255) + url = models.URLField() + + def __str__(self): + return f'{self.profile.user.username} - {self.platform}' diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..da53ecd 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,58 @@ +{% load static %} -
- -