diff --git a/.github/workflows/master_ftpapps.yml b/.github/workflows/master_ftpapps.yml
new file mode 100644
index 00000000..cfd25c25
--- /dev/null
+++ b/.github/workflows/master_ftpapps.yml
@@ -0,0 +1,62 @@
+# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
+# More GitHub Actions for Azure: https://github.com/Azure/actions
+# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
+
+name: Build and deploy Python app to Azure Web App - ftpapps
+
+on:
+ push:
+ branches:
+ - master
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python version
+ uses: actions/setup-python@v1
+ with:
+ python-version: '3.8'
+
+ - name: Create and start virtual environment
+ run: |
+ python -m venv venv
+ source venv/bin/activate
+
+ - name: Install dependencies
+ run: pip install -r requirements.txt
+
+ # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
+
+ - name: Upload artifact for deployment jobs
+ uses: actions/upload-artifact@v2
+ with:
+ name: python-app
+ path: |
+ .
+ !venv/
+
+ deploy:
+ runs-on: ubuntu-latest
+ needs: build
+ environment:
+ name: 'production'
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v2
+ with:
+ name: python-app
+ path: .
+
+ - name: 'Deploy to Azure Web App'
+ uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'ftpapps'
+ slot-name: 'production'
+ publish-profile: ${{ secrets.AzureAppService_PublishProfile_c2f557e82a9545e298a8ff89de12e554 }}
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..26d33521
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/djangoapp.iml b/.idea/djangoapp.iml
new file mode 100644
index 00000000..8e5446ac
--- /dev/null
+++ b/.idea/djangoapp.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 00000000..105ce2da
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..2641f7b4
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..9b9c4123
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..94a25f7f
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/azuresite/settings.py b/azuresite/settings.py
index 0aa259ec..316d999f 100644
--- a/azuresite/settings.py
+++ b/azuresite/settings.py
@@ -33,6 +33,8 @@
INSTALLED_APPS = [
'polls.apps.PollsConfig',
+ 'eactivities.apps.EactivitesConfig',
+ 'cars.apps.CarsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -76,10 +78,14 @@
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
- }
+ 'default': {
+ 'ENGINE': 'django.db.backends.postgresql_psycopg2',
+ 'NAME': os.environ.get('DBNAME'),
+ 'USER': os.environ.get('DBUSER'),
+ 'PASSWORD': os.environ.get('DBPASS'),
+ 'HOST': os.environ.get('DBHOST'),
+ 'PORT': '5432',
+ }
}
diff --git a/azuresite/urls.py b/azuresite/urls.py
index 7acc83f5..2a0576c3 100644
--- a/azuresite/urls.py
+++ b/azuresite/urls.py
@@ -18,5 +18,6 @@
urlpatterns = [
path('', include('polls.urls')),
+ path('', include('cars.urls')),
path('admin/', admin.site.urls),
]
diff --git a/cars/__init__.py b/cars/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/cars/admin.py b/cars/admin.py
new file mode 100644
index 00000000..8c38f3f3
--- /dev/null
+++ b/cars/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/cars/apps.py b/cars/apps.py
new file mode 100644
index 00000000..a7d5fcd7
--- /dev/null
+++ b/cars/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class CarsConfig(AppConfig):
+ name = 'cars'
diff --git a/cars/migrations/__init__.py b/cars/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/cars/models.py b/cars/models.py
new file mode 100644
index 00000000..347fee69
--- /dev/null
+++ b/cars/models.py
@@ -0,0 +1,22 @@
+from django.db import models
+
+# Create your models here.
+
+from django.db import models
+
+class Driver(models.Model):
+
+ name = models.TextField()
+
+ license = models.TextField()
+
+class Car(models.Model):
+
+ make = models.TextField()
+
+ model = models.TextField()
+
+ year = models.IntegerField()
+
+
+ owner = models.ForeignKey("Driver", on_delete=models.SET_NULL, null=True)
\ No newline at end of file
diff --git a/cars/templates/base.html b/cars/templates/base.html
new file mode 100644
index 00000000..140437b9
--- /dev/null
+++ b/cars/templates/base.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Contacts
+
+
+
+
+
+
+
+{% block page_content %}{% endblock %}
+
+
+
+
\ No newline at end of file
diff --git a/cars/templates/car_detail.html b/cars/templates/car_detail.html
new file mode 100644
index 00000000..3e6d47bf
--- /dev/null
+++ b/cars/templates/car_detail.html
@@ -0,0 +1,29 @@
+{% extends "base.html" %}
+
+{% block page_content %}
+
+
+
+
Driver: {{ drivers.name | linebreaks }}
+
+
License: {{ drivers.license }}
+
+ {% for v in vehicles %}
+
+
+
+
+
+
Make/Model: {{ v.make }} {{ v.model }}
+
+
Year: {{ v.year }}
+
+
+
+
+
+ {% endfor %}
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/cars/tests.py b/cars/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/cars/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/cars/urls.py b/cars/urls.py
new file mode 100644
index 00000000..97f89a2e
--- /dev/null
+++ b/cars/urls.py
@@ -0,0 +1,11 @@
+from django.urls import path
+
+from . import views
+
+
+
+urlpatterns = [
+
+ path("cars//", views.car_detail, name="car_detail"),
+
+]
\ No newline at end of file
diff --git a/cars/views.py b/cars/views.py
new file mode 100644
index 00000000..67dca3e2
--- /dev/null
+++ b/cars/views.py
@@ -0,0 +1,24 @@
+from django.shortcuts import render
+
+# Create your views here.
+from django.shortcuts import render
+
+from cars.models import Car, Driver
+
+
+
+def car_detail(request, pk):
+
+ owner_obj = Driver.objects.get(pk=pk)
+
+ car_objs = Car.objects.filter(owner_id=owner_obj.id)
+
+ context = {
+
+ "vehicles": car_objs,
+
+ "drivers": owner_obj,
+
+ }
+
+ return render(request, "car_detail.html", context)
\ No newline at end of file
diff --git a/eactivities/__init__.py b/eactivities/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/eactivities/admin.py b/eactivities/admin.py
new file mode 100644
index 00000000..8c38f3f3
--- /dev/null
+++ b/eactivities/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/eactivities/apps.py b/eactivities/apps.py
new file mode 100644
index 00000000..f3c91355
--- /dev/null
+++ b/eactivities/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class EactivitiesConfig(AppConfig):
+ name = 'eactivities'
diff --git a/eactivities/migrations/__init__.py b/eactivities/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/eactivities/models.py b/eactivities/models.py
new file mode 100644
index 00000000..7e0a9738
--- /dev/null
+++ b/eactivities/models.py
@@ -0,0 +1,8 @@
+from django.db import models
+
+# Create your models here.
+class UploadModel(models.Model):
+ # file will be uploaded to MEDIA_ROOT/uploads
+ # or...
+ # file will be saved to MEDIA_ROOT/uploads/2015/01/30
+ upload = models.FileField(upload_to='files',null=True)
\ No newline at end of file
diff --git a/eactivities/tests.py b/eactivities/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/eactivities/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/eactivities/views.py b/eactivities/views.py
new file mode 100644
index 00000000..91ea44a2
--- /dev/null
+++ b/eactivities/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/polls/templates/polls/index.html b/polls/templates/polls/index.html
index 18260b0d..7d2527ef 100644
--- a/polls/templates/polls/index.html
+++ b/polls/templates/polls/index.html
@@ -2,7 +2,7 @@
-Polls app
+Cea mai tare comunssxitate
{% if latest_question_list %}