Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submission-Frieds #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Freids/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Ignore compiled Python files
__pycache__/
*.pyc

# Ignore the virtual environment
venv/
.venv/
# If you're using Poetry for dependency management
.poetry/

# Ignore the local settings file (if you have one)
local_settings.py

# Ignore database files
db.sqlite3

# Ignore logs and temp files
logs/
*.log
*.log.*
*.tmp

# Ignore user-uploaded media (if you're using Django's media storage)
# media/

# Ignore IDE-specific files and directories
.vscode/
.idea/

# Ignore sensitive files and keys (add more as needed)
.env
*.key
*.pem

# Ignore database migrations (you might need to customize this)
/migrations/
Empty file added Freids/Account_App/__init__.py
Empty file.
33 changes: 33 additions & 0 deletions Freids/Account_App/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django.contrib import admin
from .models import Cuisine, Image, Review, User, BusinessAccount, Account

@admin.register(Cuisine)
class CuisineAdmin(admin.ModelAdmin):
list_display = ['name']

@admin.register(Image)
class ImageAdmin(admin.ModelAdmin):
list_display = ['title']

@admin.register(Review)
class ReviewAdmin(admin.ModelAdmin):
list_display = ['rating', 'user_account', 'business_account']

@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ['phone_number', 'is_vegetarian']

@admin.register(BusinessAccount)
class BusinessAccountAdmin(admin.ModelAdmin):
list_display = ['business_name', 'street_name', 'locality']

@admin.register(Account)
class AccountAdmin(admin.ModelAdmin):
list_display = ['email', 'username', 'is_user', 'is_business']

# Optionally, customize the form in the admin panel
fieldsets = (
('Account Info', {'fields': ('email', 'username', 'is_user', 'is_business')}),
('Profile', {'fields': ('user_profile', 'business_profile')}),
('Permissions', {'fields': ('groups', 'user_permissions')}),
)
6 changes: 6 additions & 0 deletions Freids/Account_App/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AccountAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'Account_App'
116 changes: 116 additions & 0 deletions Freids/Account_App/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Generated by Django 4.2.6 on 2023-10-25 06:08

import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]

operations = [
migrations.CreateModel(
name='BusinessAccount',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('business_name', models.CharField(max_length=100)),
('street_name', models.CharField(max_length=100)),
('locality', models.CharField(max_length=100)),
('latitude', models.DecimalField(decimal_places=6, max_digits=9)),
('longitude', models.DecimalField(decimal_places=6, max_digits=9)),
],
),
migrations.CreateModel(
name='Cuisine',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True)),
],
),
migrations.CreateModel(
name='Image',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=100)),
('image', models.ImageField(upload_to='images/')),
],
),
migrations.CreateModel(
name='User',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(max_length=100, unique=True)),
('phone_number', models.CharField(max_length=15)),
('image', models.ImageField(upload_to='user_images/')),
('is_vegetarian', models.BooleanField()),
],
),
migrations.CreateModel(
name='Account',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('email', models.EmailField(max_length=254, unique=True)),
('username', models.CharField(max_length=150)),
('is_user', models.BooleanField(default=False)),
('is_business', models.BooleanField(default=False)),
('business_profile', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='account_business_profile', to='Account_App.businessaccount')),
('groups', models.ManyToManyField(blank=True, related_name='account_groups', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, related_name='account_user_permissions', to='auth.permission', verbose_name='user permissions')),
('user_profile', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='account_user_profile', to='Account_App.user')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='Review',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('rating', models.IntegerField(choices=[(0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5')], validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(5)])),
('comment', models.TextField()),
('business_account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='account_reviews', to='Account_App.businessaccount')),
('images', models.ManyToManyField(to='Account_App.image')),
('user_account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='account_reviews', to='Account_App.user')),
],
),
migrations.AddField(
model_name='businessaccount',
name='cuisines',
field=models.ManyToManyField(to='Account_App.cuisine'),
),
migrations.AddField(
model_name='businessaccount',
name='images',
field=models.ManyToManyField(related_name='business_account_images', to='Account_App.image'),
),
migrations.AddField(
model_name='businessaccount',
name='menu',
field=models.ManyToManyField(related_name='business_account_menu', to='Account_App.image'),
),
migrations.AddField(
model_name='businessaccount',
name='reviews',
field=models.ManyToManyField(related_name='business_accounts', to='Account_App.review'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.6 on 2023-10-25 06:18

import django.contrib.auth.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='account',
name='email',
field=models.EmailField(blank=True, max_length=254, verbose_name='email address'),
),
migrations.AlterField(
model_name='account',
name='username',
field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username'),
),
]
17 changes: 17 additions & 0 deletions Freids/Account_App/migrations/0003_remove_user_username.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.6 on 2023-10-25 07:26

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0002_alter_account_email_alter_account_username'),
]

operations = [
migrations.RemoveField(
model_name='user',
name='username',
),
]
18 changes: 18 additions & 0 deletions Freids/Account_App/migrations/0004_alter_user_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.6 on 2023-10-25 07:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0003_remove_user_username'),
]

operations = [
migrations.AlterField(
model_name='user',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='user_images/'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.6 on 2023-10-25 08:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0004_alter_user_image'),
]

operations = [
migrations.AlterField(
model_name='businessaccount',
name='images',
field=models.ManyToManyField(blank=True, null=True, related_name='business_account_images', to='Account_App.image'),
),
migrations.AlterField(
model_name='businessaccount',
name='menu',
field=models.ManyToManyField(blank=True, null=True, related_name='business_account_menu', to='Account_App.image'),
),
migrations.AlterField(
model_name='businessaccount',
name='reviews',
field=models.ManyToManyField(blank=True, null=True, related_name='business_accounts', to='Account_App.review'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 4.2.6 on 2023-10-25 12:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0005_alter_businessaccount_images_and_more'),
]

operations = [
migrations.AlterModelManagers(
name='account',
managers=[
],
),
migrations.AlterField(
model_name='account',
name='username',
field=models.CharField(max_length=30, unique=True),
),
migrations.AlterField(
model_name='businessaccount',
name='images',
field=models.ManyToManyField(blank=True, related_name='business_account_images', to='Account_App.image'),
),
migrations.AlterField(
model_name='businessaccount',
name='menu',
field=models.ManyToManyField(blank=True, related_name='business_account_menu', to='Account_App.image'),
),
migrations.AlterField(
model_name='businessaccount',
name='reviews',
field=models.ManyToManyField(blank=True, related_name='business_accounts', to='Account_App.review'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2.6 on 2023-10-26 05:22

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0006_alter_account_managers_alter_account_username_and_more'),
]

operations = [
migrations.AddField(
model_name='businessaccount',
name='primage',
field=models.ImageField(blank=True, null=True, upload_to='images/'),
),
migrations.AlterField(
model_name='review',
name='business_account',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='account_reviews', to='Account_App.businessaccount'),
),
migrations.AlterField(
model_name='review',
name='user_account',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='account_reviews', to='Account_App.user'),
),
]
18 changes: 18 additions & 0 deletions Freids/Account_App/migrations/0008_alter_review_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.6 on 2023-10-26 11:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Account_App', '0007_businessaccount_primage_and_more'),
]

operations = [
migrations.AlterField(
model_name='review',
name='images',
field=models.ManyToManyField(blank=True, to='Account_App.image'),
),
]
Empty file.
Loading