Skip to content

Upgrade #8

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

Open
wants to merge 4 commits 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ coverage.xml
.static_storage/
.media/
local_settings.py
.sqlite3
db.sqlite3

# Flask stuff:
instance/
Expand Down
18 changes: 18 additions & 0 deletions accounts/migrations/0002_alter_customuser_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.5 on 2024-03-07 23:31

from django.db import migrations, models


class Migration(migrations.Migration):

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

operations = [
migrations.AlterField(
model_name='customuser',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
]
Binary file modified db.sqlite3
Binary file not shown.
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ django-appconf==1.0.5
django-cors-headers==3.13.0
django-environ==0.9.0
djangorestframework==3.14.0
djangorestframework-simplejwt==5.2.2
djangorestframework-simplejwt==5.3.1
fire==0.5.0
gunicorn==20.1.0
idna==3.4
Expand All @@ -15,8 +15,9 @@ pytz==2022.7.1
rcssmin==1.1.1
requests==2.28.2
rjsmin==1.2.1
setuptools==69.1.1
six==1.16.0
sqlparse==0.4.3
termcolor==2.2.0
urllib3==1.26.14
whitenoise==6.3.0
whitenoise==6.6.0
6 changes: 6 additions & 0 deletions templates/things/thing_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ <h5 class="text-xl font-medium text-gray-900 dark:text-white">Create a Thing</h5
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
value="0" min="0" max="5" required>
</div>
<div>
<label for="id_description" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Thing Description</label>
<input type="text" name="description" id="id_description"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
placeholder="e.g. crunchy" required>
</div>
<div>
<label for="id_reviewer" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Reviewer</label>
<select name="reviewer" id="id_reviewer">
Expand Down
9 changes: 4 additions & 5 deletions templates/things/thing_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

{% block content %}

<div class="space-y-8 p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700">
<div class="p-6 space-y-8 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700">

<div class="flex">

<h5 class=" flex-auto mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{{ thing.name }}</h5>
<h5 class="flex-auto mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{{ thing.name }}</h5>


<a href="{% url 'thing_update' thing.pk %}">
Expand All @@ -29,8 +29,7 @@ <h5 class=" flex-auto mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:

</div>

<h5 class=" flex-auto mb-2 text-md font-bold tracking-tight text-gray-900 dark:text-white">Reviewed by: {{
thing.reviewer }}</h5>
<h5 class="flex-auto mb-2 font-bold tracking-tight text-gray-900 text-md dark:text-white">Reviewed by: {{ thing.reviewer.username }}</h5>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes formatting to display reviewers's username



<p class="mb-3 font-normal text-gray-700 dark:text-gray-400">{{ thing.description }}</p>
Expand Down Expand Up @@ -67,4 +66,4 @@ <h5 class=" flex-auto mb-2 text-md font-bold tracking-tight text-gray-900 dark:t



{% endblock content %}
{% endblock content %}
27 changes: 27 additions & 0 deletions things/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.1.5 on 2024-03-07 23:31

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


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Thing',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=256)),
('rating', models.IntegerField(blank=True, default=0)),
('description', models.TextField(blank=True, default='', null=True)),
('reviewer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
2 changes: 1 addition & 1 deletion things/views_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ThingUpdateView(LoginRequiredMixin, UpdateView):
class ThingCreateView(LoginRequiredMixin, CreateView):
template_name = "things/thing_create.html"
model = Thing
fields = ["name", "rating", "reviewer"] # "__all__" for all of them
fields = "__all__" # "__all__" for all of them


class ThingDeleteView(LoginRequiredMixin, DeleteView):
Expand Down