Răsfoiți Sursa

add partner info tickets add

sayapinavalentina 1 an în urmă
părinte
comite
d5042624a1

+ 2 - 2
SharixAdmin/urls.py

@@ -62,5 +62,5 @@ urlpatterns = [
     
     re_path(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
 ]
-if DEBUG:
-    urlpatterns += path('v1/auth/', include('djoser.urls')),
+#if DEBUG:
+#    urlpatterns += path('v1/auth/', include('djoser.urls')),

+ 39 - 2
SharixAdmin/views/partner_info.py

@@ -1,3 +1,5 @@
+from datetime import timezone
+import datetime
 from django.shortcuts import render
 from SharixAdmin.forms import PartnerInformationCreateForm, PartnerInformationUpdateForm
 from SharixAdmin.groups import group_required
@@ -8,10 +10,44 @@ from SharixAdmin.views.context import get_context
 from django.urls import reverse
 from django.utils.translation import gettext as _
 
+from core.utils.AuthAPI import AuthAPI
+from tickets.models import Task
+from core.config import API_URL
+api = AuthAPI("89855703300", "12345")
+import requests
+from django.urls import reverse_lazy
+
 class PartnerInformationCreate(UserPassesTestMixin, CreateView):
     model = Company
     form_class = PartnerInformationCreateForm
     template_name = "SharixAdmin/partner_information_form.html"
+    success_url = reverse_lazy("SharixAdmin:partners")
+
+    def form_valid(self, form):
+        form.instance.representative_id = self.request.user
+        #responce = super().form_valid(form)
+        
+        #print(responce)
+        new_ticket = {
+            "task_list": 1,
+            "created_by": self.request.user.pk,
+            "type": 1,
+            "title": "service_create",
+            "note": str(form.data),
+        }
+        
+        
+        resp = requests.post(f"{API_URL}/tickets/api/tickets/", data=new_ticket, headers=api.headers)
+        #print(resp.json())
+        jso = resp.json()
+        print(resp.content)
+        print(resp.json())
+        print(resp)
+        #form.cleaned_data['ticket_status'] = Task.objects.get(pk=int(jso['id']))
+        form.instance.ticket_status = Task.objects.get(pk=int(jso['id']))
+        print(form.cleaned_data)
+        responce = super().form_valid(form)
+        return responce
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
@@ -22,7 +58,7 @@ class PartnerInformationCreate(UserPassesTestMixin, CreateView):
         return context
     
     def get_success_url(self):
-        return reverse('test-page')
+        return reverse('partners')
     
     def test_func(self) -> bool or None:
         group_names = ('PARTNER-ADMIN')
@@ -51,7 +87,8 @@ class PartnerInformationUpdateView(UserPassesTestMixin, UpdateView):
         if bool(self.request.user.groups.filter(name=group_names)) or self.request.user.is_superuser:
             return True
         return False
-    
+
+
 def partner_information(request):
     context = get_context(request, {
         'title':_('Partner Information'),

+ 3 - 3
core/settings.py

@@ -134,9 +134,9 @@ LANGUAGES = [
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/4.1/howto/static-files/
 
-STATIC_URL = conf.STATIC_URL
-STATICFILES_DIRS = conf.STATICFILES_DIRS
-STATIC_ROOT = conf.STATIC_ROOT
+STATIC_URL = '/static/'
+STATICFILES_DIRS = [BASE_DIR / "SharixAdmin/static/", BASE_DIR / "tickets/static/"]
+STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
 # Uploaded media
 MEDIA_ROOT = os.path.join(BASE_DIR, "media")
 MEDIA_URL = "/media/"

+ 7 - 7
install_win.bat

@@ -1,23 +1,23 @@
 @echo off
+git clone https://git.sharix-app.org/ShariX_Open/sharix-open-webapp-design-template.git design_template
 cd design_template/
-git clone https://git.sharix-app.org/ShariX_Open/sharix-open-webapp-design-template.git
 git checkout unstable
 cd ..
+git clone https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git tickets
 cd tickets/
-git clone https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git 
 git checkout unstable
 cd ..
+git clone https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git metaservicesynced
 cd metaservicesynced/
-git clone https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git
 git checkout unstable
 cd ..
+git clone https://git.sharix-app.org/ShariX_Open/sharix-open-config.git sharix-open-config
 cd sharix-open-config/
-git clone https://git.sharix-app.org/ShariX_Open/sharix-open-config.git
 git checkout unstable
 cd ..
-cd webservice_running/ 
-git clone https://git.sharix-app.org/ShariX_Open/sharix-open-webservice-running.git
-git checkout unstable 
+git clone https://git.sharix-app.org/ShariX_Open/sharix-open-webservice-running.git webservice_running
+cd webservice_running/
+git checkout unstable
 cd ..
 python -m venv env
 .\env\Scripts\activate && pip install -r requirements.txt && python manage.py makemigrations && python manage.py migrate && python manage.py createsuperuser && python manage.py runserver

BIN
media/tasks/attachments/1/payment.png