Browse Source

first view

master
Adrien MAES 8 months ago
parent
commit
4293ba39bb
  1. 2
      facecook/urls.py
  2. 4
      main/models.py
  3. 7
      main/urls.py
  4. 3
      main/views.py

2
facecook/urls.py

@ -15,7 +15,9 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls import include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('main.urls')),
]

4
main/models.py

@ -7,7 +7,7 @@ class UserExt(models.Model):
avatar = models.ImageField(upload_to='images/avatars', null=True, blank=True)
class Space(models.Model):
admins = models.ManyToManyField(UserExt, blank=True)
admins = models.ManyToManyField(UserExt, blank=True, related_name="space_admins")
users = models.ManyToManyField(UserExt, blank=True)
class Recipe(models.Model):
@ -17,7 +17,7 @@ class Recipe(models.Model):
content = models.TextField(blank=True)
date = models.DateTimeField(default=timezone.now)
picture = models.ImageField(upload_to='images/recipes', null=True, blank=True)
tags = models.ManyToManyField(Tag, blank=True)
tags = models.ManyToManyField('Tag', blank=True)
class React(models.Model):
recipe = models.ForeignKey('Recipe', on_delete=models.CASCADE)

7
main/urls.py

@ -0,0 +1,7 @@
from django.urls import path
from . import views
urlpatterns = [
path('', views.accueil, name='main_accueil'),
]

3
main/views.py

@ -1,3 +1,4 @@
from django.shortcuts import render
# Create your views here.
def accueil(request):
return render(request, 'main/base.html', locals())

Loading…
Cancel
Save