Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How do i retrieve a list of users for django-graphql-auth and graphene-django?
Using django==3.1.5 graphene-django==2.15.0 django-graphql-auth==0.3.15 django-graphql-jwt==0.3.0 I am trying to allow a foreign key to be set from a model to a user in my GraphQL API. class WorkOrder(BaseModel, models.Model): service_technician = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.PROTECT, related_name='service_technician', null=True ) When trying to query for the list of users, I get the expected response. query getUsers { users { edges { node { username, archived, verified, email, secondaryEmail, } } } } However, when trying to query for all workorders, I am getting an error { "errors": [ { "message": "Cannot query field \"serviceTechnician\" on type \"WorkOrderType\".", "locations": [ { "line": 35, "column": 5 } ] } ] } This is my current input for workorder and user in schema.py class UserInput(graphene.InputObjectType): id = graphene.ID() username = graphene.String() email = graphene.String() password1 = graphene.String() password2 = graphene.String() class WorkOrderInput(graphene.InputObjectType): id = graphene.ID() service_technician = graphene.List(UserInput) My UserType definition inherits from UserNode in graphql_auth\schema.py class UserType(UserNode): class Meta: model = get_user_model() filter_fields = app_settings.USER_NODE_FILTER_FIELDS exclude = app_settings.USER_NODE_EXCLUDE_FIELDS interfaces = (graphene.relay.Node,) skip_registry = True pk = graphene.Int() archived = graphene.Boolean() verified = graphene.Boolean() secondary_email = graphene.String() And finally, my CreateWorkOrder mutation class CreateWorkOrder(graphene.Mutation): class Arguments: input = WorkOrderInput(required = True) ok = graphene.Boolean() workorder = … -
Make a table row field in a django template multi column
I have a template that includes all the HTML for a table on a form. I am using a generic form for my model. My model looks like this: class Program(models.Model): air_date = models.DateField(default="0000-00-00") air_time = models.TimeField(default="00:00:00") service = models.CharField(max_length=10) block_time = models.TimeField(default="00:00:00") running_time = models.TimeField(default="00:00:00") remaining_time = models.TimeField(default="00:00:00") title = models.CharField(max_length=255) locked_flag = models.BooleanField(default=False) deleted_flag = models.BooleanField(default=False) library = models.CharField(null=True,max_length=255,blank=True) mc = models.CharField(null=True,max_length=64) producer = models.CharField(null=True,max_length=64) editor = models.CharField(null=True,max_length=64) remarks = models.TextField() audit_time = models.DateTimeField(null=True) audit_user = models.CharField(null=True,max_length=32) The template form looks like this: <form method="post"> {% csrf_token %} <TABLE BORDER="0" TABLE_LAYOUT="fixed" WIDTH="100%"> <TR BGCOLOR="#15C1B5"> <TD ALIGN="Right">Program Title:</TD><TD ALIGN="Left">{{ form.title }}</TD> <TD ALIGN="Right">Library:</TD><TD ALIGN="Left">&nbsp;{{ form.library }}</TD> <TD ALIGN="Right">Service Bureau:</TD><TD ALIGN="Left">&nbsp;{{ form.service }}</TD> </TR> <TR BGCOLOR="#15C1B5"> <TD ALIGN="Right">Program Id:</TD><TD ALIGN="Left">&nbsp;{{ program.pk }}</TD> <TD ALIGN="Right">Air Date:</TD><TD ALIGN="Left">&nbsp;{{ form.air_date }}</TD> <TD ALIGN="Right">Air Time</TD><TD ALIGN="Left">&nbsp;{{ form.air_time }}</TD> </TR> <TR BGCOLOR="#15C1B5"> <TD ALIGN="Right">Producer:</TD><TD ALIGN="Left">&nbsp;{{ form.producer }}</TD> <TD ALIGN="Right">Editor:</TD><TD ALIGN="Left">&nbsp;{{ form.editor }}</TD> <TD ALIGN="Right">MC:</TD><TD ALIGN="Left">&nbsp;{{ form.mc }}</TD> </TR> <TR BGCOLOR="#15C1B5"> <TD BGCOLOR="#99CCFF" ALIGN="Right">Duration:</TD> <TD BGCOLOR="#99CCFF" ALIGN="Left">&nbsp;{{ form.block_time }}</TD> <TD BGCOLOR="#8DF1BF" ALIGN="Right">Rem. Time:</TD> <TD BGCOLOR="#8DF1BF" ALIGN="Left">&nbsp;{{ form.remaining_time }}</TD> <TD BGCOLOR="#CC99CC" ALIGN="Right">Run Time:</TD> <TD BGCOLOR="#CC99CC" ALIGN="Left">&nbsp;{{ form.running_time }}</TD> </TR> <TR BGCOLOR="#15C1B5"> <TD ALIGN="Right">Remarks:</TD><TD COLSPAN="5"><PRE>{{ form.remarks }}</PRE></TD> </TR> </TABLE> The table looks fine - but the remarks field … -
How can a child class access its parent attributes without the "parent.attrib" syntax in Django?
I'm totally confused in Django I can create a child class which is PostAdmin(admin.ModelAdmin) with "admin.ModelAdmin" as its parent and assign a tuple to the "list_display"(tip: list_display is an attribute of admin.ModelAdmin class) inside the PostAdmin without writing "admin.ModelAdmin.list_display"...while in python to address a parent class's attribute one needs to use the "parent.attrib" syntax and the fact is when I try admin.ModelAdmin.list_display it gives me errors! here is the code in my "admin.py": from django.contrib import admin # Register your models here. from blog.models import post class PostAdmin(admin.ModelAdmin): admin.ModelAdmin.list_display= ('title','publish', 'status') admin.site.register(post,PostAdmin) what am I missing? I've searched a lot about python inheritance and couldn't understand the way the inheritance works in here...to be exact, How the child class (PostAdmin) assigns the "('title','publish', 'status')" to its parent(ModelAdmin)? how does it get there? here are some parts of admin.ModelAdmin codes(which is made by Django and located in options.py) that I found by going to ModelAdmin's definition the first time list_display is used in options.py (where ModelAdmin is defined) class BaseModelAdmin(metaclass=forms.MediaDefiningClass): #... def get_sortable_by(self, request): """Hook for specifying which fields can be sorted in the changelist.""" return self.sortable_by if self.sortable_by is not None else self.get_list_display(request) """Encapsulate all admin options and functionality for … -
Trying login at admin Django page
I'm taking the free Django course with Prof. Charles Severance (Dr. Chuck), and at Lesson 6, I am having some troubles to login at the admin page of django, i.e. I've created successfully the username and the password, but at the moment to enter I receive this message " Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive. " . source page: http://djtutorial.dj4e.com/admin I am using the Dr chuck's link "http://djtutorial.dj4e.com/admin" to login, because he said I can not use the runserver cmd line in pythonanywhere, so that, I run the manage.py cmd and then reload the web page, but the problem is still there. When I try to connect within the local host there is any connection, so, I have to use http://djtutorial.dj4e.com/admin. I have already check the username and the password with the following cmds: from django.contrib.auth.models import User user = User.objects.get(username='username') user.check_password('password') TRUE What can I do? Thanks in advanced. -
How to group swagger API with drf_yasg
I am doing some migration work from Django 1.11 --> 3.1.5 previously with "rest_framework_swagger", I am able to accomplish swagger api grouping just by this in url.py url(r'^api/v9/test_token1$', api.test_token, name='test_token'), url(r'^api/v9/test_token2$', api.test_token, name='test_token'), and get this (notice it groups v9) However, I have tried with "drf_yasg" on Django 3.1.5 url.py path('/v2/token_api1', token_api1, name='token_api1'), path('/v2/token_api2', token_api2, name='token_api2'), my api definition (do note I am using @api_view) token = openapi.Parameter('token', openapi.IN_FORM, type=openapi.TYPE_STRING, required=True) @swagger_auto_schema( method="post", manual_parameters=[token], operation_id="token_api1" ) @api_view(['POST']) # this is optional and insures that the view gets formdata @parser_classes([FormParser]) def token_api1(request): token = request.POST['token'] return Response("success test_api:" + token, status=status.HTTP_200_OK) token = openapi.Parameter('token', openapi.IN_FORM, type=openapi.TYPE_STRING, required=True) @swagger_auto_schema( method="post", manual_parameters=[token], operation_id="token_api2" ) @api_view(['POST']) # this is optional and insures that the view gets formdata @parser_classes([FormParser]) def token_api2(request): token = request.POST['token'] return Response("success test_api:" + token, status=status.HTTP_200_OK) however, I get this (noticed v2 does not group). And also when I did a test, there were errors as well. (Code 404 Error: Not Found) How can I group these to API in drf_yasg and also making sure there is no error ? Note if the url.py is like this, there is NO error but it does not group path('token_api1', token_api1, name='token_api1'), path('token_api2', token_api2, … -
Django views: Using a queryset with exclude after a for loop
in my views.py I have a queryset (bytes) that I loop through, adding a style property to certain items in the queryset: bytes = Byte.objects.order_by('-publish_date') for d in bytes: if not d.published: d.style = 'my-style' Then in my views, I have another conditional statement: if most_recent != most_shared: bytes = bytes.exclude(byte_id=most_shared_id) But then when I sent bytes to the template, none of the info from the loop (if any item in the bytes got d.style) is there. How can I make this so when I use exclude I'm doing so on the bytes that just went through the loop?? -
Django logout method doesnt functionate
This is my first django project with login/out. On login the user is successfully redirected to his dashboard, however when I click logout nothing happens. Any ideas how can I fix this issue? view: def logout(request): #logout(request) if request.method == 'POST': auth.logout(request) messages.success(request, 'You are now logged out') return redirect('login') html: {% if user.is_authenticated %} <div id = 'dashboard' class="the-dashboard"> <div class="prof"> <p ><span class = 'fntmk'>Welcome</span> {{ user.username }}</p> <img src = "{% static 'images/profile-trans.jpg' %}"> </div> <div class="the-panel"> <form action = "{% url 'logout' %}" method = "POST"> {% csrf_token %} <a class = 'fntmk'><i class="far fa-user-circle size"></i>&nbsp;&nbsp;&nbsp;Profil</a> <a href="{% url 'logout' %}" class = 'logout fntmk prob' alt='exit'><span class="material-icons">logout</span><span class = 'odjavi'>Logout</span></a> </div></form> </div> {% else %} <div class="the-login"> <form action = "{% url 'login' %}" method = "POST"> {% csrf_token %} <input type = 'text' id = 'username' class = 'username-field' placeholder = 'username' required> <input type = 'password' id = 'password' placeholder = 'password' required> <a href= "{% url 'login' %}"> <button class = 'btn-login'>Login</button></a> </form> <a href = "{% url 'register' %}" class = 'register fntmk'>New User?</a> </div> {% endif %} urls> path('register/',register, name = 'register'), path('accounts/dashboard/',login, name = 'login'), path('',logout, name = 'logout'), -
Can't access text saved in a Quill form on Django template
In my django template I want to access the bio prop of an instance of my Creator class. This bio is set up as a QuillField in the Creator model class. When I try to access creator.bio, all that renders to the page is the following: <django_quill.fields.FieldQuill object at 0x1084ce518> What I want is the actual paragraph of formatted text (ie. the bio) that I typed into the form and saved. As of now, the QuillField is only accessible through the form in the Django admin page. The problem has nothing to do with the Quill UI, but rather being able to access the text I wrote into that form field and render it to the page in a readable format. From models.py: from django.db import models from django_quill.fields import QuillField class Creator(models.Model): name = models.CharField(max_length=100) title = models.CharField(max_length=100, default='Creator') bio = QuillField() photo = models.ImageField(upload_to='images/', default='static/assets/icons/user-solid.svg') email = models.EmailField(max_length=100) website = models.URLField(max_length=1000, blank=True) facebook = models.URLField(max_length=1000, blank=True) twitter = models.URLField(max_length=1000, blank=True) instagram = models.URLField(max_length=1000, blank=True) def __str__(self): return self.name In views.py: def about(request): context = {"creators" : Creator.objects.all()} return render(request, 'about.html', context) And, in the template: <section id="creator-container"> {% for creator in creators %} <div class="creator-square"> <h4>{{ creator.name }}</h4> … -
How can i add a param to the existing url?...Django...Paginator
I have made a page with which displays some data from the database. I have added a paginator to my website. my website also has a search bar. so when the user searches for something....the URL is... .../search/?q=xyz so when I paginate the searched data with... <a href="?page={{ walls.next_page_number }}"> next page </a> it makes the URL as... .../search/?page=2 but that's an error...but, I want something like this... .../search/?q=xyz&page=2 how can I achieve this... -
Pulling a Database from Heroku and not able to process data
I used pg:pull to pull a database to my local database. It was all working as expected until it got to the processing data step. Here is the error I received, it was on the first entry in the database. pg_restore: processing data for table "a1pavingco.account_emailaddress" pg_restore: error: unrecognized data block type (0) while searching archive events.js:287 throw er; // Unhandled 'error' event ^ Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:154:25) at writeGeneric (internal/stream_base_commons.js:145:3) at Socket._writeGeneric (net.js:784:11) at Socket._write (net.js:796:8) at doWrite (_stream_writable.js:442:12) at writeOrBuffer (_stream_writable.js:426:5) at Socket.Writable.write (_stream_writable.js:317:11) at Socket.ondata (_stream_readable.js:695:22) at Socket.emit (events.js:310:20) at Socket.Readable.read (_stream_readable.js:493:10) Emitted 'error' event on Socket instance at: at errorOrDestroy (internal/streams/destroy.js:108:12) at Socket.onerror (_stream_readable.js:729:7) at Socket.emit (events.js:310:20) at errorOrDestroy (internal/streams/destroy.js:108:12) at onwriteError (_stream_writable.js:457:5) at onwrite (_stream_writable.js:484:5) at internal/streams/destroy.js:50:7 at Socket._destroy (net.js:677:5) at Socket.destroy (internal/streams/destroy.js:38:8) at afterWriteDispatched (internal/stream_base_commons.js:154:17) { errno: 'EPIPE', code: 'EPIPE', syscall: 'write' } I don't know what to make of this error or how to fix it. I can see the database via PGAdmin however there are no entries within the columns. I have tested that with queries that returned nothing. Any advice on how to solve this problem will be much appreciated! -
Weird try/except in Django's get_or_create()
I'm looking into the source of Django's get_or_create() method and wondering what the try/except on the line 590 is doing? Could it just be removed? -
Mismatching url from build_absolute_uri('/confirm/') Django Sendgrid
I am trying to send a confirmation email with sendgrid, but when user click the link, it generated My Page not found error: The current path,/confirm//confirm/, didn't match any of these. This my views.py message = Mail( from_email=settings.FROM_EMAIL, to_emails=sub.email, subject='Newsletter Confirmation', html_content='Thank you for signing up for my email newsletter! \ Please complete the process by \ <a href="{}/confirm/?email={}&conf_num={}"> clicking here to \ confirm your registration</a>.'.format(request.build_absolute_uri('/confirm/'), sub.email, sub.conf_num)) sg = SendGridAPIClient(settings.SENDGRID_API_KEY) response = sg.send(message) def confirm(request): sub = Subscriber.objects.get(email=request.GET['email']) if sub.conf_num == request.GET['conf_num']: sub.confirmed = True sub.save() return render(request, 'app/index.html', {'email': sub.email, 'action': 'confirmed'}) else: return render(request, 'app/index.html', {'email': sub.email, 'action': 'denied'}) app level urls.py: path('confirm/', views.confirm, name='confirm'), path('delete/', views.delete, name='delete'), I know there must be the problem of build_absolute_uri('/confirm/') or the confirm view, I have tried different attempts by changing the url build_absolute_uri('confirm/') or build_absolute_uri('') but it still didn't match any url. -
Can a model have 2 many to many relations with another model?
I'm developing an application that has the following three models: Student, Subject and Skills. A Student can have many skills, and a Skill can have many student. A Subject can offer 0 or many skills after a Student complete it, however, a Student has to have 0 or many skills required to complete a Subject. How could I manage this? I've tried to create two many to many fields inside Subject called 'requiredskills' and 'offeredskills' both related to Skill, however it didn't work. -
PUT on many to many Django rest framework
models class Customer(models.Model): user = models.ForeignKey(User,on_delete=models.CASCADE,null=True) phone = models.CharField(max_length=11,blank=True,null=True) likecus=models.ManyToManyField(smartphone ,verbose_name="лайк") class smartphone(models.Model): title=models.CharField(max_length=255) Serializer class CreateCustomerSerializer(serializers.ModelSerializer): class Meta: model = Customer fields = ('phone', 'likecus') I get the error that the required field of Customer is not sent. This setup works for PUT call however. The issue with PUT call is that when I call the PUT call again, it overrides the existing data in the CreateCustomerSerializer relation field with the new data and not simply appends the data of second API call to the first. How can I POST data so that I am able to link existing smartphone records with Customer records? through the Primary Key Related Field. I have this created has not changed. I don't know, some people have solved the problem this way. it doesn't work for me -
How to get next available object or primary key from database in django
I am trying for a music player and i want to get next music from database with current music's id. So if anyone could tell how to get next primary key with current id. This is the code for getting current music. music = Contents.objects.get(id=id) The id that I passed is primary key of current music. So instead of the code above please do suggest how can I get next music. -
django with docker dosen't see pillow
I'm trying to deploy my project on django. I almost did it but django can't see installed pillow in docker container. I'm sure that it's installed pip sends me this: sudo docker-compose -f docker-compose.prod.yml exec web pip install pillow Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pillow in /usr/local/lib/python3.8/site-packages (8.1.0) But when i'm trying to migrate db i see this: ERRORS: history_main.Exhibit.image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow". history_main.MainUser.avatar: (fields.E210) Cannot use ImageField because Pillow is not installed. -
How can I save a flag on Proxy model field?
I know it is probably very basic knowledge, but for some reason looking for basic Django stuff is really painful. I have one main model, which is then used as proxy to create second model. I then change second model in admin.py in order to use less fields than original model, and I wanted to use a flag (either True in Boolean field, or 'y' or whatever) to show that it was created using proxy model without user interaction (so I don't want person to manually click the Boolean field or whatever). So basically, in models.py: class MainModel(models.Model): is_proxy = whatever (can be Boolean, can be Char, whatever works) (...) class ProxyModel(MainModel): class Meta: proxy = True admin.py: class FromProxyModel(admin.ModelAdmin): fieldsets = ( `less fields than original model`,) //here is a function or something I would like to use to save value of is_proxy to True, y or whatever admin.site.register(ProxyModel, FromProxyModel) Could you please help me how can I properly change the value of is_proxy field, to be set only when proxy model was used? -
POST on many to many Django rest framework
models class Customer(models.Model): user = models.ForeignKey(User,on_delete=models.CASCADE,null=True) phone = models.CharField(max_length=11,blank=True,null=True) likecus=models.ManyToManyField(smartphone ,verbose_name="лайк") class smartphone(models.Model): title=models.CharField(max_length=255) Serializer class CreateCustomerSerializer(serializers.ModelSerializer): class Meta: model = Customer fields = ('phone', 'likecus') I get the error that the required field of A is not sent. This setup works for PUT call however. The issue with PUT call is that when I call the PUT call again, it overrides the existing data in the AB relation field with the new data and not simply appends the data of second API call to the first. How can I POST data so that I am able to link existing B records with A records? through the Primary Key Related Field. I have this created has not changed. I don't know, some people have solved the problem this way. it doesn't work for me -
Converting dynamic website to android applications
I have a dynamic website build on Django. I want to create an apk and with no knowledge on building apks I I found out there are few methods to convert a website to an app in few minutes. I want to know if the functionality of the app remains the same. I want someone to explain me how does it work. Does the database get updated when I update the database using the apk? or if it is even possible to update the database in my server? or does the app remain static?. Being a noob I need your help in this. -
How to access different static files for different Django applications on IIS?
Suppose I have two Django apps: DjangoApp1 and DjangoApp2 I have created a website with DjangoApp1 in IIS with some IP(192.168.1.1) on port 80, and I can access this website on 192.168.1.1/, the static files are loaded by the virtual directory static, and this site is seen perfectly as expected. Now, for the second app, DjangoApp2, I need to access it through the same IP address in this way: 192.168.1.1/app2/, so I created an Application in my website with the name app2 and configured it accordingly. Now, since DjangoApp2 has a different set of static files, I need to configure my server so that it loads those files as well. Since I already have a virtual directory named static, I can't create one with the same name. I tried creating app2_static and all other combinations, but these files were not loading. All the other functionalities of this app work correctly, which are not dependent on the local static files. How do I configure the StaticFileModule so that it loads the necessary files for DjangoApp2, without disturbing the files of DjangoApp1? I have used FastCgi and wfastcgi module of Django for the deployment configurations. -
Can Django Template language replace JavaScript in a beginner project? [closed]
I am a beginner programmer and I am currently making a web project which involves booking equipment and storing/ retrieving it from the inventory. Basic website, about 5-7ish webpages and around 4-5 tables in the database of the app. I have decided to use django for the same. I had some confusion, do I HAVE to use any JavaScript at all for developing this web project? Can i make it entirely using Django - and HTML/CSS obviously? I have around 25 days to complete this and have currently made some very simple HTML/CSS pages and implemented some django template language in them, like 'extends', forms, etc. Any help is greatly appreciated! Thank You. Pranay -
how to fetch data from ManyToManyFIeld
I am trying to fetch data from ManyToMany Field Here is model : class Product(models.Model): name = models.CharField(max_length=100) slug = models.CharField(max_length=200) product_main_image = models.ImageField(upload_to="images/", null=True, blank=True) product_other_images = models.ManyToManyField(ProductImages, blank=True) category = models.ForeignKey(Category, on_delete=models.CASCADE) brand = models.ForeignKey(Brand, on_delete=models.CASCADE) price = models.IntegerField(null=True, default=0) discount_price = models.IntegerField(null=True, blank=True, default=0) discount_percentage = models.IntegerField(null=True, blank=True, default=0) size = models.ManyToManyField(ProductSizes, blank=True) # height = models.IntegerField(null=True, blank=True) # weight = models.IntegerField(null=True, blank=True) # length = models.IntegerField(null=True, blank=True) color = models.ManyToManyField(ProductColors, blank=True) spec = models.ManyToManyField(ProductSpces, blank=True) uoms = models.ManyToManyField(UOM) stock = models.BooleanField() SKU = models.CharField(max_length=150) currency = models.ForeignKey(Currency, on_delete=models.CASCADE, null=True, blank=True) description = models.TextField(null=True, blank=True) def __str__(self): return self.name Here is my product model where there is a object called uoms.Which is ManyToField. Here is my UOM model: class UOM(models.Model): title = models.CharField(max_length=100) height = models.DecimalField(null=True, default=0, max_digits=10, decimal_places=2) width = models.DecimalField(null=True, default=0, max_digits=10, decimal_places=2) weight = models.DecimalField(null=True, default=0, max_digits=10, decimal_places=2) length = models.DecimalField(null=True, default=0, max_digits=10, decimal_places=2) quantity = models.IntegerField(null=True, default=1) def __str__(self): return self.title From this UOM model i took manytomanyfield. So now, i have a page where all the options showed in a drop down. but when a customer will choose one of the uoms it will pass with the cart. Here is a sample … -
Can't access nested dictionary data **kwargs python and best practices for nested data mutation in GraphQL
In Graphene-Django and GraphQL I am trying to create a resolve_or_create method for nested data creation inside my mutations. I'm trying to pass a dictionary with the input from the user as a **kwarg to my resolve_or_create function, and though I can see "location" in the variable watcher (in VSCode), I continuously am getting the error 'dict' object has no attribute 'location' Here's my resolve_or_create method: def resolve_or_create(*args, **kwargs): input = {} result = {} input.location = kwargs.get('location', None) if input.location is not None: input.location = Location.objects.filter(pk=input.location.id).first() if input.location is None: location = Location.objects.create( location_city = input.location.location_city, location_state = input.location.location_state, location_sales_tax_rate = input.location.location_sales_tax_rate ) if location is None: return None result.location = location and my CreateCustomer definition, where this method is being called class CreateCustomer(graphene.Mutation): class Arguments: input = CustomerInput(required=True) ok = graphene.Boolean() customer = graphene.Field(CustomerType) @staticmethod def mutate(root, info, input=None): ok = True resolved = resolve_or_create(**{'location':input.customer_city}) customer_instance = Customer( customer_name = input.customer_name, customer_address = input.customer_address, customer_city = resolved.location, customer_state = input.customer_state, customer_zip = input.customer_zip, customer_email = input.customer_email, customer_cell_phone = input.customer_cell_phone, customer_home_phone = input.customer_home_phone, referred_from = input.referred_from ) customer_instance.save() return CreateCustomer(ok=ok, customer=customer_instance) Here is an example mutation that would create a new customer with an existing location mutation createCustomer { … -
Django PWA navbar is only hidden on the first page ios
I'm using a Django Project as PWA and the navbar is only hidden at the first page. At the moment an href is used the navbar gets visible. Is there any were to fix it ? -
Search for partial match and case insensitive in django_filters
In my filters.py I have a filter: class myFilter(django_filters.FilterSet): class Meta: model= bdMuebles fields = ["Type","Code","Name"] and in views.py I have: def vwMuebles(request): vrMuebles=bdMuebles.objects.all() vrFiltroMbl=myFilter(request.GET,queryset=vrMuebles) vrMuebles=vrFiltroMbl.qs return render(request,"MyApp/Muebles.html",{ "dtMuebles":vrMuebles, "dtFiltroMbl": vrFiltroMbl, }) My question is: How can myfilter search for partial matches with case insensitive, ie, if type app it gives MyApp Application Apple