diff options
Diffstat (limited to 'src/booking')
-rw-r--r-- | src/booking/migrations/0008_auto_20201109_1947.py | 30 | ||||
-rw-r--r-- | src/booking/views.py | 11 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src/booking/migrations/0008_auto_20201109_1947.py b/src/booking/migrations/0008_auto_20201109_1947.py new file mode 100644 index 0000000..289e476 --- /dev/null +++ b/src/booking/migrations/0008_auto_20201109_1947.py @@ -0,0 +1,30 @@ +# Generated by Django 2.2 on 2020-11-09 19:47 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0007_remove_booking_config_bundle'), + ] + + operations = [ + migrations.AlterField( + model_name='booking', + name='collaborators', + field=models.ManyToManyField(blank=True, related_name='collaborators', to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='booking', + name='opnfv_config', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='resource_inventory.OPNFVConfig'), + ), + migrations.AlterField( + model_name='booking', + name='resource', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='resource_inventory.ResourceBundle'), + ), + ] diff --git a/src/booking/views.py b/src/booking/views.py index bd57812..c41a7d6 100644 --- a/src/booking/views.py +++ b/src/booking/views.py @@ -19,7 +19,7 @@ from django.db.models import Q from django.urls import reverse from resource_inventory.models import ResourceBundle, ResourceProfile, Image, ResourceQuery -from account.models import Downtime +from account.models import Downtime, Lab from booking.models import Booking from booking.stats import StatisticsManager from booking.forms import HostReImageForm @@ -44,6 +44,7 @@ def quick_create(request): context['form'] = QuickBookingForm(lab_data=attrs, default_user=request.user.username, user=request.user) context['lab_profile_map'] = {} context.update(drop_filter(request.user)) + context['contact_email'] = Lab.objects.filter(name="UNH_IOL").first().contact_email return render(request, 'booking/quick_deploy.html', context) if request.method == 'POST': @@ -74,9 +75,15 @@ class BookingView(TemplateView): def get_context_data(self, **kwargs): booking = get_object_or_404(Booking, id=self.kwargs['booking_id']) title = 'Booking Details' + contact = Lab.objects.filter(name="UNH_IOL").first().contact_email downtime = Downtime.objects.filter(lab=booking.lab, start__lt=timezone.now, end__gt=timezone.now()).first() context = super(BookingView, self).get_context_data(**kwargs) - context.update({'title': title, 'booking': booking, 'downtime': downtime}) + context.update({ + 'title': title, + 'booking': booking, + 'downtime': downtime, + 'contact_email': contact + }) return context |