Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ERROR: Could not find a version that satisfies the requirement Variation
Im trying to install Variation to Python by using pip install Variation and I encountered this problem ERROR: Could not find a version that satisfies the requirement Variation (from versions: none) ERROR: No matching distribution found for Variation What should I do ? -
Handling django form views using ajax
I am looking for more elegant way to solve this problem. Say I have say two buttons x, y in main.html: <input class= "btn-check", name = "options", id="x"> <label class="btn btn-lg btn-info", for="x">x</label> <input class= "btn-check", name = "options", id="y"> <label class="btn btn-lg btn-success", for="y">y</label> What I want to do is after the button is clicked, I will do something in python and so in django views I will create a view function for each of the buttons (my current implementation): funcX(request): booleanX = doSomethingforX() return JsonResponse({"success": booleanX}) funcY(request): booleanY = doSomethingforY() return JsonResponse({"success": booleanY}) and the ajax calls would be: $("[id='x']").on("click", function(e){ e.preventDefault(); $.ajax({ type:"GET", url: "{% url 'funcX' %}", success: function(response){ if(response.success == true){ //Do something } } }) }); The ajax call will be the same for button Y. Now, I was wondering if it is possible to do this with forms? Say the html becomes: <form method="POST", class="form-group", id="post-form"> <input type="submit", value="x", class= "btn-check", name = "options", id="x"> <label class="btn btn-lg btn-info", for="x">x</label> <input type="submit", value="y", class= "btn-check", name = "options", id="y"> <label class="btn btn-lg btn-success", for="y">y</label> </form> Then in django views I have a view for the main.html. This way it saves a lot of … -
Formar DecimalField as integer when there are no digits
I have a model with a DecimalField and a ModelForm for that model. When editing an instance of that model with a field value with no digits, I'd like the input to be formatted as a regular integer instead of a decimal number of with digits, e.g. I'd like to display 3 instead of 3.000. And only when there's actual digits they should be displayed. How can I override the way instance field values are displayed in a form? I tried with self.fields[fieldname].initial = formatted_value or formatting it through clean_fieldname but it didn't work. -
How to redirect back to a dynamic page after deleting a record in Django
I have the following working code to delete a record from a table through the following url/view and template: urls urlpatterns = [ path('portfolio/<str:pk>/', views.portfolio, name="portfolio"), path('delete_identifier/<str:pk>/', views.deleteIdentifier, name="delete_identifier"), ] View def portfolio(request, pk): portfolio = Account.objects.get(id=pk) identifiers = Identifier.objects.filter(account=pk) context = {"portfolio": portfolio, "identifiers": identifiers} return render(request, 'portfolio.html', context) def deleteIdentifier(request, pk): identifier = Identifier.objects.get(id=pk) identifier.delete() return redirect('portfolio') template (portfolio.html) <table class="table table-sm"> {% for item in identifiers %} <tr> <td>{{item.code}}</td> <td style="width:10px;"><a class="delete_btn" onclick="return confirm('Are you sure?');" href="{% url 'delete_identifier' item.id %}">Delete</a></td> </tr> {% endfor %} </table> However the issue is with my redirect in the view - I'm basically trying to go back to the same page where I'm deleting the record from 'portfolio' but am unable to. Instead I get redirected to: 127.0.0.1:8000/delete_identifier/882/ with the following error on on page: DoesNotExist at /delete_identifier/882/ Identifier matching query does not exist. My expectation is to be redirected back to the original page of: 127.0.0.1:8000/portfolio/205/ where I started from. I'd greatly appreciate some help in resolving this issue. Thanks in advance -
How to deal with missing columns on old data migrations?
I want to add a new column to a django model. However, I have a past data migration that creates an object of this model, which now doesn't work because the column didn't exist at the time of that migration. i.e. my model is: class MyModel(models.Model): name = models.CharField() foo = models.IntegerField() # <-- I want to add this column however my old migration is this: def add_my_model(apps, schema_editor): MyModel.objects.create(name="blah") class Migration(migrations.Migration): # ... operations = [ migrations.RunPython(add_my_model), ] And when I try to run migrations on a fresh db, this migration fails with an error similar to this: query = 'INSERT INTO "my_model" ("name", "foo") VALUES (?, ?)' params = ['blah', None] ... E sqlite3.OperationalError: table my_model has no column named foo What's the best way to deal with this situation? -
Python manage.py error, it´s for Intel M1?
I wanted to know if you could help me, the question is that when I do a makemigrations in Django or Python I get this error and I have not been able to fix it, and I have not been able to start the server to work, I do not know if something similar has happened and I can tell me what to do, it is on a MacBook M1 Traceback (most recent call last): File "/Users/jesusochoagonzalez/Documents/GitHub/cip_django/aplications/globaldata/views.py", line 1, in <module> from asyncio.windows_events import NULL File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/windows_events.py", line 6, in <module> raise ImportError('win32 only') ImportError: win32 only -
Adding variants of the same language to Django?
I am working on localization of a Django app, and the requirement dictated us to have 2 type of Traditional Chinese-- Taiwan and Hong Kong. However, looking at the Django code, ... ... ("vi", gettext_noop("Vietnamese")), ("zh-hans", gettext_noop("Simplified Chinese")), ("zh-hant", gettext_noop("Traditional Chinese")), ] It seems to only support one Traditional Chinese language. I tried putting the language zh-hant-hk in setings.py. But instead of falling back to the Traditional Chinese or English, I got an error instead. Had been looking at the documentation but didn't seem to be mentioned anywhere... -
Django AdminEmailHandler: Exception while resolving variable 'exception_type' in template 'unknown
I'm trying to get the admin error emails to work in Django REST. My logging configuration is like this: 'loggers': { 'django': { 'handlers': ['console', 'logfile', 'mail_admins'], 'level': 'DEBUG', 'propagate': True, }, }, When 'mail_admins' is included as a handler, if I try to throw an error on a view like this: @api_view() def index(request): a = 2/0 The division by zero error is thrown (as expected), but then I get another error and a long traceback that starts like this: DEBUG 2022-03-09 00:22:45,984 base 58083 123145391022080 Exception while resolving variable 'exception_type' in template 'unknown'. Traceback (most recent call last): File "/path/to/.venv/lib/python3.10/site-packages/django/template/base.py", line 875, in _resolve_lookup current = current[bit] File "/path/to/.venv/lib/python3.10/site-packages/django/template/context.py", line 83, in __getitem__ raise KeyError(key) KeyError: 'exception_type' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/path/to/.venv/lib/python3.10/site-packages/django/template/base.py", line 881, in _resolve_lookup if isinstance(current, BaseContext) and getattr( AttributeError: type object 'Context' has no attribute 'exception_type' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/path/to/.venv/lib/python3.10/site-packages/django/template/base.py", line 891, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'exception_type' -
Django project requirements that's not suitable for DigitalOcean App Platform?
For a django project with celery for async tasks, nginx, gunicorn, users and user uploaded files to aws s3, 3rd party api calls, displaying api response data and database queries etc... what does it mean that digitalocean app platform is for static sites, what exactly can't it do? I watched a video where it's explained that DO app platform can handle dynamic content with react etc but that it doesn't support background services. I'm not exactly sure what this means if you can use celery. Some people asked questions on digital ocean but didn't get an answer: https://www.digitalocean.com/community/questions/how-to-create-celery-worker-on-app-platform https://www.digitalocean.com/community/questions/what-are-the-limitations-of-digital-ocean-apps Also various videos and online posts don't really go into what non-static site features can't be used, it's just mentions that it's for static sites and data is ephemeral. Also the tutorial videos just deploy the default django app so I don't get to see what it can and can't be used for. In one post it says "if your app does require you to have access to the underlying infrastructure, you'll probably want to steer away from App Platform", what are examples of needing to access underlying infrastructure? Another comment from a post is "if your app doesn't have complex … -
Python : Log Decorator
Implement a decorator that logs the invocations of the decorated function to the provided file descriptor.You can assume that it will only decorate functions that take in positional arguments. The log line should follow this format Log: (comma separated call_paramters) theatre character should be new line. The line should be logged prior to the execution of the decorated functions body. -
Unable to get clear box and choose file button on same line as file in HTML Form
I created a form that shows my users email, username and a link of their profile picture, but I am unable to get the choose file and clear button and check box to be on the same line the form as the link and I am unsure as to why and I have tried changing the css but it does not let me change or implement them on the same line within the form. Html {% extends 'parasites_app/base.html' %} {% load static %} {% block content_block %} <!-- It has to be here to load content from the extending templates --> <link rel="stylesheet" type="text/css" href="/static/css/editprofile.css" xmlns="http://www.w3.org/1999/html"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <form id="EditProfile" method="POST" action="/edit_profile/" enctype="multipart/form-data"> <h2>Edit Profile</h2> <input type="hidden" name="csrfmiddlewaretoken" value="GSiPiZjdV1XpJ6I5tZJfXuHUqGXqFWBalLxoWCKB6DqfzPalNRm6X3uc2QFp5NuY"> {% csrf_token %} <br> <table> <tbody> <tr> <th><label for="id_email">Email:</label></th> <td><input type="email" name="email" value="hannah.bialic@glasgow.ac.uk" required="" id="id_email"> </td> </tr> <tr> <th><label for="id_username">Username:</label></th> <td><input type="text" name="username" value="hannah.bialic" maxlength="150" required="" id="id_username"><br></td> </tr> <tr> <th> <label for="id_picture">Current Picture:</label></th> <td> <li> <a href="/media/profile_images/parapic_Kuw8fB7.png">profile_images/parapic_Kuw8fB7.png</a> </li> <span><input type="file" name="picture" accept="image/*" id="id_picture"> Clear<input type="checkbox" name="picture-clear" id="picture-clear_id"></span> </td> </tr> </tbody> </table> <!-- Make changes button--> <div> <button type="submit" class="button">Make Changes</button> </div> </form> <script>$(".helptext").remove();</script> Css body { font-family: "Poppins", sans-serif; margin: 0; } h1 { text-align: left; font-family: "Poppins", sans-serif; color: white; … -
Django render_to_string not including certain context variables when rendering
I have searched here and not found anything so far that helps. When using render_to_string and providing context variables, one of these variables gets used by the template as expected, however, another variable seems completely ignored. The view. Creates a chunk of HTML consisting of the rendered thumbnail templates. NB: the 'image' context works fine! It is only the 'click_action' that seems to be ignored. def ajax_build_image_thumbnail(request): image_ids = request.POST.get('ids', None) html_string = '' response = {} for id in image_ids: image_instance = UserImage.objects.get(pk=id) context = { 'click_action': "showEditImageModal", 'image': image_instance, } html_string += render_to_string('auctions/includes/imageThumbnail.html', context) response['html'] = html_string return JsonResponse(response) The imageThumbnail template: <div id="{{ image.id }}"> <a href="#" data-click-action="{{ click_action }}"></a> </div> The result: <div id="265"> <a href="#" data-click-action=""></a> </div> The expected result: <div id="265"> <a href="#" data-click-action="showEditImageModal"></a> </div> So, as you can see, the data-click-action attribute on the anchor is blank in the rendered template, where it should contain the context variable "click_action" Things I have tried: Using autoescape Wrapping the anchor in a {% with %} tag and setting "click_action" as a local template variable. Hard-coding "click_action" in the view, and setting it to a variable. Switching the order of variables (thinking in case the function … -
Azure / Django / Ubuntu | tkinter & libtk8.6.so import issue
When Azure builds & deploys a Python3.9 Django/Django-Rest WebApp it has been failing in it's start up. Error in question ( full logs below ) 2022-03-08T21:13:30.385999188Z File "/tmp/8da0147da65ec79/core/models.py", line 1, in <module> 2022-03-08T21:13:30.386659422Z from tkinter import CASCADE 2022-03-08T21:13:30.387587669Z File "/opt/python/3.9.7/lib/python3.9/tkinter/__init__.py", line 37, in <module> 2022-03-08T21:13:30.387993189Z import _tkinter # If this fails your Python may not be configured for Tk 2022-03-08T21:13:30.388227101Z ImportError: libtk8.6.so: cannot open shared object file: No such file or directory I have come across other answers to this needing to make sure that tkinter is installed with sudo apt-get python3-tk which I have added to the deployment yml file Though it still seems to have issue. Reverting back to previous code for deployment is successful and the only feature that has been added to the application is Celery. Not sure if that has anything to do with it or not. Am I adding the installation of the tk/tkinter in the wrong sequence? build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python version uses: actions/setup-python@v1 with: python-version: "3.9" - name: Create and start virtual environment run: | python -m venv venv source venv/bin/activate - name: Install TK dependency run: | sudo apt-get update sudo apt-get install … -
Method to link logged Author to Article they created not working
Something is wrong with my method, assign_article_creator. It's supposed to populate the field, custom_user, with the username (email address) of the logged-in user/author, so that the author is associated with any article that they create. But it's not working. In Django Admin, the field custom_user is populated with '----' when an author creates an article. Please help me. Thank you. models.py class CustomUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_('email address'), unique=True) class Articles(models.Model): custom_user = models.ForeignKey(CustomUser, default=None, null=True, on_delete=models.SET_NULL) views.py class CreateArticle(LoginRequiredMixin, CreateView): model = Articles form_class = ArticleForm template_name = "users/add_article.html" def assign_article_creator(self, request): if request.method == 'POST': form = self.form_class(request, data=request.POST) if form.is_valid(): instance = form.save(commit=False) instance.custom_user = request.user instance.save() return render(request=request, template_name ="users/add_article.html", context={"form": form}) -
How can I get Django Form ModelChoiceField values from Class View back to the template from which they came
I am trying to display a list of tests, select one with ModelChoiceField Form and then display the selected test information on the same template the ModelChoiceField is on. (2 fields - the ID number and the name) as a link. So basically you select the test, it appears under the ModelChoiceField as a link and then you click it go to a detail screen. I can capture the selected choice information in the class view in form_valid but I don't know how to return to the template with this new information. Tried various approaches with context etc. but nothing is working. The screen will look something like this: When you press the select button the test selected will appear on the same screen. I need access to both the name and id number, which I get in form_valid # forms.py class TestBrowseForm(forms.Form): choice = forms.ModelChoiceField( Universal_Test_File.objects.all().order_by('test_name'), to_field_name="service_id") # views.py class ListTests(FormView): model = Universal_Test_File context_object_name = "testlist" form_class = TestBrowseForm template_name = "lab/list_tests.html" success_url = '/list_tests/' def form_valid(self, form): # choice is a queryset with both service_id and testname so we need to specify service_id choice = form.cleaned_data.get("choice") ## I want to display the test_name and link to service_id … -
Restrict user registration with registration key
I want to restrict who can register on my site. I want to achieve this by asking for a registration key in the registration form. The key should be valid X amount of times, so not it can not be used by everyone forever. I have created two separate models, one user model and one registration key model. In the User model, have I created a key field, which is a foreign key related to the registration key model. These are my two models class RegistrationKey(models.Model): key = models.CharField(max_length=30) max_amount = models.IntegerField(null=True) class User(AbstractUser): ... key = models.ForeignKey(RegistrationKey, on_delete=models.CASCADE) The problem however is that I don't know how to validate that the key the user enters in the registration form is registered in the model and that the key is still valid, in other words still not being used more than X times. I would appreciate all sorts of help, even sources that describes similar problems because I have not been able to find any. -
sever error ,contact the administrator in django4.0
When i tried to access the admin in django 4.0.3, ** A server error occurs, contact the administrator ** in the terminal it returns the timezone error,while the timezone has not yet be modified how do i resolve this working on termux -
How to get data from django many to many fields?
Model: class Message_Manu(models.Model): Message = models.CharField(max_length=50) def str(self): return str(self.pk) +"."+" "+ self.Message class Frontend_Order(models.Model): USer = models.ForeignKey(User,default=None,on_delete=models.CASCADE,related_name='user_frontend_order') Service_Type = models.CharField(max_length=250, null=True) Price = models.CharField(max_length=250, null=True) Number_of_Section = models.CharField(max_length=250, null=True) Website_Functionality = models.CharField(max_length=50, null=True) Email = models.EmailField(max_length=50, null=True) files = models.FileField(upload_to="0_frontend_files/", null=True, blank=True) created_date = models.DateTimeField(auto_now_add=True, null=True) order_message = models.ManyToManyField(Message_Manu) Views: def index(request): total_user = User.objects.count()-1 frontend_order_list = Frontend_Order.objects.order_by("pk") backend_order_list = Backend_Order.objects.order_by("pk") Complete_Website_Order_list = Complete_Website_Orders.objects.order_by("pk") context = { "total_user":total_user, "frontend_order_list":frontend_order_list, "backend_order_list":backend_order_list, "Complete_Website_Order_list":Complete_Website_Order_list } return render(request,'0_index.html',context) -
How to Deploying Django project on ionos
I have a Django project that I want to deploy on ionos but I don't know how to do this. Please who knows how to do this? -
Django saving forms to sqlite database
I am completely new to django and I am currently working on this program which is already in production. Now I need to save certain forms to a sqlite database and I've watched some tutorials however I cannot understand how to do this. Here is a portion of the code: {% block content %} <!-- Modal --> <div class="card shadow-sm"> <div class="card-header" id="headingOne"> <h5 class="mb-0"> Receptas</h5> <span class="d-flex flex-row-reverse"><button class="btn btn-secondary" id="save_recipe_btn" type="button"><i class="bi bi-save"></i></br> Saugoti</button></span> </div> <div id="card-base" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div class="card-body"> <div class="row"> <div class="col"> {% csrf_token %} {{recipe_form.ibu}} {{recipe_form.abv}} <div class="row"> <div class="col">{{recipe_form.name|as_crispy_field}}</div> <div class="col">{{recipe_form.style|as_crispy_field}}</div> </div> <div class="row"> <div class="col">{{recipe_form.batch_size|as_crispy_field}}</div> <div class="col">{{recipe_form.boile_time|as_crispy_field}}</div> <div class="col">{{recipe_form.efficiency|as_crispy_field}}</div> </div> <div class="row"> <div class="col">{{recipe_form.primary_age|as_crispy_field}}</div> <div class="col">{{recipe_form.secondary_age|as_crispy_field}}</div> <div class="col">{{recipe_form.age|as_crispy_field}}</div> </div> <div class="row"> <div class="col">{{recipe_form.pub_date|as_crispy_field}}</div> </div> <div class="row"> <div class="col">{{recipe_form.notes|as_crispy_field}}</div> </div> </div> Now I need to save forms like name, style, batch size and so on. In all the tutorials I watch they do something like doing method = post and making the button type = submit However, this whole code looks quite a bit different than what they do in the tutorials and I am unsure whether I still should be saving in the same way or should I do something … -
How to Implement SSO using Django and React
I wanted to achieve Single Sign-On similar to Google, Youtube, Gmail, Drive where only you have to sign in only one time for all the apps. My application backend is on Django Rest Framework - Using JWT Token Front-end: I have two different React apps hosted on two different domains. I read that, google used cookies for the SSO but I haven't found any practical example on how to achieve it. -
Integrating a payment application (API) in a django application
I have a Django web application in which I would like to integrate a local payment API in order to enable customers who want to use their money from this payment application to pay their car insurance but honestly, I don't have any idea of how to do it. Below are the related models (Contrat and Reglement): class Contrat(models.Model): Statut_contrat = ( ('Encours', 'Encours'), ('Suspendu', 'Suspendu'), ('Expiré', 'Expiré'), ) categorie_choices =( ('Tourisme', 'Tourisme'), ('Transport', 'Transport') ) # numero_de_contrat = shortuuid.uuid() type_contrat = models.ForeignKey(TypeContrat, on_delete=models.CASCADE, null=True, blank=False) tca = models.DecimalField(_('TCA 4%'),max_digits=10, decimal_places=2, default=0.00) numero_de_contrat = models.CharField(max_length=50, blank=True, null=True,db_index=True, unique=True) statut_assurance =models.CharField(max_length=15, choices=Statut_contrat, default='Non') vehicule = models.ForeignKey(Vehicule, on_delete=models.CASCADE) utilisateur = models.ForeignKey(User, on_delete=models.CASCADE) nombre_de_mois = models.IntegerField(null=True, blank=True) sous_couvert = models.CharField(_('S/C'),max_length=200, null=True, blank=True) categorie = models.CharField(max_length=50, choices=categorie_choices, null=False, blank=False, default='Tourisme') created = models.DateField(auto_now_add=True) modified = models.DateField(auto_now=True) active = models.BooleanField(default=True) remainingdays=models.IntegerField(default=0) blocked_date=models.DateField() unblocked_date = models.DateField(null=True, blank=True) history = HistoricalRecords() class Meta: ordering=('-created',) @property def static_id(self): 'C{0:07d}'.format(self.pk) def __str__(self): return str(self.numero_de_contrat) def save(self, *args, **kwargs): self.tca=self.type_contrat.montant_du_contrat*Decimal(0.04) if self.statut_assurance=="Suspendu": dt=abs(self.blocked_date-self.modified) print('Difference est:',dt) numberOfDaysLeft= self.remainingdays-dt.days print('Big diff',numberOfDaysLeft) self.remainingdays=numberOfDaysLeft self.blocked_date=date.today() super(Contrat, self).save(*args, **kwargs) def activeStatus(self): if self.nombre_de_mois==0: return self.active==False else: return self.active==True def get_NbDays(self): if self.statut_assurance=='Encours': # nb_Days = timedelta(days=self.remainingdays)+date.today() nb_Days = timedelta(days=self.remainingdays)+self.blocked_date print('Date de fin', nb_Days) return nb_Days … -
How to change information inside hidden tags in .as_table form
I have used .as_table in my website design to format my form, but now I am experiencing problems where random text is displaying within the form that I cant change inside my html document but when I run the website and inspect it I can see the tags and elements inside it and I was wondering how I would remove or change the 'Currenlty' and 'Change' Element being displayed. Html within Visual Studio {% block content_block %} <link rel="stylesheet" type="text/css" href="{% static 'css/editprofile.css' %}" xmlns="http://www.w3.org/1999/html"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <form id="EditProfile" method="POST" action='/edit_profile/' enctype="multipart/form-data"> <h2>Edit Profile</h2> {% csrf_token %} <table> {{ form.as_table }} <br> {{ profile_form.as_table }} </table> <!-- Make changes button--> <div> <button type="submit" class="button">Make Changes</button> </div> </form> <script>$( ".helptext" ).remove();</script> {% endblock %} Html inside web browser <table> <tbody><tr><th><label for="id_email">Email:</label></th><td><input type="email" name="email" value="c.@gmail.com" required="" id="id_email"></td></tr> <tr><th><label for="id_username">Username:</label></th><td><input type="text" name="username" value="ctuck" maxlength="150" required="" id="id_username"><br></td></tr> <tr><th><label for="id_picture">Picture:</label></th><td>Currently: <a href="/media/profile_images/parapic_Kuw8fB7.png">profile_images/parapic_Kuw8fB7.png</a> <input type="checkbox" name="picture-clear" id="picture-clear_id"> <label for="picture-clear_id">Clear</label><br> Change: <input type="file" name="picture" accept="image/*" id="id_picture"></td></tr> </tbody></table> -
How could I solve using Deleteview to cancel an order .... error NoReverseMatch at / orderbook /Error
I would like to cancel an order made by the user but it reports an error; Reverse for 'delete_order' with no arguments not found. 1 pattern(s) tried: ['orderbook/(?P[0-9]+)/delete/\Z']and and not what the problem is. class Order(models.Model): CHOICES = (("BUY", "BUY"), ("SELL", "SELL")) _id = ObjectIdField() profile = models.ForeignKey(Profile, on_delete=models.CASCADE) position = models.CharField(max_length=8, choices=CHOICES, default="BUY") status = models.Field(default="open") price = models.FloatField() quantity_max_insert = models.FloatField() datetime = models.DateTimeField(auto_now_add=True) def get_absolute_url(self): return reverse("exchange:orderbook", kwargs={"_id": self._id}) view class DeleteOrder(DeleteView): model = Order success_url = "/" def get_queryset(self): queryset = super().get_queryset() return queryset.filter(profile_id=self.request.user) <div class="container"> <div class="row row-cols-2"> {% for orders in page.object_list %} <div class=" col"> <div class ="card my-1 border border-info mb-3 "> <div class="card-header bg-info"> <h5>{{ orders.profile.user.email }}</h5><p class="text-dark mb-0">{{ orders.datetime|date:"M d Y H:m:s" }}</p> {% if orders.status == 'open' and request.user == orders.profile.user %} <p>{{ orders.id }} <a href="{% url 'delete_order' %}">Delete</a> {% endif %} </div> -
Microsoft Azure - how to locate ML models
I have been writing Python for a number of years and I'm at a fairly decent level. I have never formally studied Computer Science. I have been reading about and using Azure Cognitive Services for one of my applications which uses the Microsoft Azure Cognitive Service' textanalytics service for Language Detection based on text input. As per my understanding Microsoft (MS) has trained some powerful ML models that are used for their cognitive services package. I understand that all the code is open source: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics And I am able to do some basic navigation through the SDK documentation and repo to solve my purpose. However, I want to understand that if Microsoft does use a ML model for the text analytics service or any other cognitive service where is the actual model saved in the repository. While navigating the repository I was expecting to find a call to some sort of serialized file (eg .pkl, .yaml) which loads the model and makes a prediction / returns an output. However, for the life of me, after spending a couple of hours I am lost in this massive repo with no results. To make it easier, I'd be interested to know where …