Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Vscode does not show arguments suggestion for models fields
It should be like this screenshot But in my case it shows this instead screenshot I use newest version of vscode (1.71.2), I have tried every django extensions on marketplace, nothing work. How can I fix this? -
AttributeError: 'ForeignKey' object has no attribute 'types_pizza_set'
AttributeError: 'ForeignKey' object has no attribute 'types_pizza_set' I want to get the values from the types_pizza model and immediately assign the value of the field in the new model How can this be done correctly? from django.db import models ##### тип пиццы, время готовки размер стоимость class types_pizza(models.Model): pizza_type = models.CharField(max_length= 30, help_text="type pizza") # цена по размерам 30 35 40 45 price_small = models.BigIntegerField(help_text="price_small") price_midle = models.BigIntegerField(help_text="price_midle") price_large = models.BigIntegerField(help_text="price_large") price_very_large = models.BigIntegerField(help_text="price_very_large") def __str__(self): return str(self.pizza_type) + "price: " + str(self.price_small) + " "+ str(self.price_midle) + str(self.price_large ) + str(self.price_very_large) ### тип данных для заказа class order_to_user(models.Model): id_oder = models.AutoField(primary_key =True, ) adress_order = models.CharField(max_length=30) def __str__(self): return self.adress_order ### тут хранится пицца заказанная и прекрепляется к заказу class pizza(models.Model): SIZE_CHOISE=[ ("sm", "small"), ("md", "middle"), ("lg", "large"), ("vlg", "very large" ), ] pizza_type = models.ForeignKey(types_pizza , on_delete=models.CASCADE ) pizza_size = models.CharField(max_length= 5, choices=SIZE_CHOISE, default="md", verbose_name="размер") order_pizza = models.ForeignKey(order_to_user, on_delete=models.CASCADE) number_of_units_pizza= models.BigIntegerField( unique=False ) ## price = pizza_type.types_pizza_set.price_small def __str__(self): return str(self.pizza_type) + "шт" -
django admin site returns MultipleObjectsReturned exception with inspectdb imported legacy database and composite primary key
Using inspectdb, I have imported a legacy database, that contains entities with composite primary keys, in django . The database schema contains about 200 different entities and inspectdb is quite handy in that situation. This is the schema in mysql: CREATE TABLE `mymodel` ( `id` bigint(20) unsigned NOT NULL DEFAULT '0', `siteid` bigint(20) unsigned NOT NULL DEFAULT '0', ... PRIMARY KEY (`siteid`,`id`), ... Following the autogenerated model in django (imported using python manager.py inspectdb) class Mymodel(models.Model): id = models.PositiveBigIntegerField() siteid = models.PositiveBigIntegerField(primary_key=True) ... class Meta: managed = False db_table = 'mymodel' unique_together = (('siteid', 'id'), I have registered all models in the admin site using the following approach: from django.contrib import admin from django.apps import apps app = apps.get_app_config('appname') for model_name, model in app.models.items(): admin.site.register(model) After all the work is done, I navigate to the admin site and click on any object in the "mymodel" section and the following exception will be returned: appname.models.Content.MultipleObjectsReturned: get() returned more than one Mymodel-- it returned more than 20! Obviously, (this is what it seems to me at least) admin is using the siteid to get the object, tough it should use the unique_together from the Meta class. Any suggestions how I can achieve … -
jquery can't select unique elements using classes
I'm trying to use ajax on some auto generated html elements from django. I saw that you do this by selecting the instances via the class, but I can't seem to get it working. What do I have wrong here? javascript $(document).ready(function() { $('.fix-button').on('submit', function(event) { event.preventDefault(); var $issue_id = $(this); $.ajax({ url: '{% url "fix_issue" %}', type: 'POST', datatype: 'json', data: { issueid: $issue_id.val(), csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]').val(), action: 'post' }, success: function (json) { document.getElementById("fixed_bool").innerHTML = json['result'] console.log(json) }, error: function (xhr, errmsg, err) { } }); }); }); html <button class = "fix-button" value = "{{ issue.id }}">Fix</button> views.py def FixView(request): if request.POST.get('action') == 'post': result = '' id = int(request.POST.get('issueid')) issue = get_object_or_404(Issue, id=id) if issue.fixed == False: issue.fixed = True result = str(issue.fixed) issue.save() else: issue.fixed = False result = str(issue.fixed) issue.save() return JsonResponse({'result': result, }) -
how do i solve this permission denied error when i run python manage.py startapp
am pretty new to django and i just installed VS code and python and django too. then in the VS terminal when i type python manage.py startapp base i get the error bash: /c/Users/Admin/AppData/Local/Microsoft/WindowsApps/python: Permission denied. how do i tackle this problem. i don't think this is a VS issue, am suspecting its from my installation or something. i installed django in my desktop and it was successfull. what then could be denying it permission -
Can someone help me to understand why this is happening?
Problem is shown in the link given below ** when i try to hover or press on the navlinks it's not selecting but showing text cursor but by moving a few inches it shows why this is happening is something wrong with the padding or its the chrome ? ** (https://www.youtube.com/watch?v=Vbt5geHBPz4) my html code {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- icons --> <link rel="stylesheet" href="https://unpkg.com/boxicons@latest/css/boxicons.min.css"> <!-- own css --> <link rel="stylesheet" href="{% static '/css/home/style.css' %}"> <!-- google fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Abyssinica+SIL&family=Montserrat:wght@500&display=swap" rel="stylesheet"> <title>Document</title> </head> <body> <header> <a href="#" class="logo">TakeAway</a> <div class="bx bx-menu" id="menu-bar"></div> <ul class="navbar"> <li><a href="#"></a>Home</li> <li><a href="#"></a>Home</li> <li><a href="#"></a>Home</li> <li><a href="#"></a>Home</li> </ul> </header> </body> mycss *{ margin: 0; padding: 0; box-sizing: border-box; font-family: 'Abyssinica SIL', serif; scroll-behavior: smooth; list-style: none; text-decoration: none; } :root{ --main-color:rgb(243, 176, 88); --text-color:#fff; --bg-color:#ff4b24; --big-font:5rem; --h2-font:2.25rem; --p-font:0.9rem; } *::selection{ background:var(--main-color); color: rgb(0, 0, 0); } body{ color: var(--text-color); background: var(--bg-color); } header{ position: fixed; top: 0; right: 0; width: 100%; z-index: 1000; display: flex; align-items: center; justify-content: space-between; padding: 30px 150px; background: var(--bg-color); } .logo{ color: var(--main-color); font-weight: 600; font-size: 2.4rem; } .navbar{ … -
Sorting the search result
I'm starting to learn Django and I ran into this problem: I can't add parameters to the link Example: Link before the change: http://127.0.0.1:8000/?brand=&search= Link after the change: http://127.0.0.1:8000/?brand=&search=&sort= What I get: http://127.0.0.1:8000/?sort= How to implement it? views.py def filters(request): #search search_post = request.GET.get('search', '') if search_post: all = Product.objects.filter(Q(title__icontains=search_post) & Q(content__icontains=search_post)).order_by() else: all = Product.objects.all() #sort by price sort_by = request.GET.get("sort", '') if sort_by == "l2h": all = Product.objects.all() all = all.extra(order_by = ['-price']) elif sort_by == "h2l": all = Product.objects.all().order_by('price') filters = IndexFilter(request.GET, queryset=all) context = { 'filters': filters } return render(request, 'index.html', context) urls.py from django.urls import path from .views import * urlpatterns = [ path('', filters, name='filters') ] index.html <form method="get" action="{% url 'filters' %}"> {{ filters.form }} <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="search"> <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> <a class="filter_by" href="?sort=l2h">Price:--low to high</a> <a class="filter_by" href="?sort=h2l">Price:-- high to low</a> </form> -
I am working on a django project that involves three models as indicated below Client,Loan,Payment
I am getting alot of duplicates in my template when i try to call the calculated loan payments in templates. My models: class Client(models.Model): full_name = models.CharField(max_length=200,blank=True) staff=models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.SET_NULL,null=True,blank=True,related_name="client") date = models.DateTimeField(default=timezone.now) class Loan(models.Model): ref = ShortUUIDField(length=6,max_length=6,alphabet="ABCDZXFQFHKRKL0123456789",unique=True) loan_amount = models.IntegerField(blank=True,null=True) staff=models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.SET_NULL,null=True,blank=True,related_name="loans") search_client=models.ForeignKey(Client,on_delete=models.SET_NULL,null=True,blank=True) @cached_property def loan_repayments(self): myfilter = Loan.objects.filter(ref=self.ref,payment__payment_reason='loan repayment') result=myfilter.aggregate(total=Sum(F('payment__amount'))) total = result['total'] if total is None: return 0 return total class Payment(models.Model): ref = ShortUUIDField(length=6,max_length=6,alphabet="ABCDZXFQFHKRKL0123456789",unique=True) payment_reason = models.CharField(max_length=200, null=True, blank=True,choices=PAYMENT_REASON,default='loan repayment',db_index=True) amount = models.IntegerField(blank=True, null=True) lender = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, blank=True, null=True, related_name="payments") loan = models.ForeignKey(Loan, on_delete=models.CASCADE, blank=True, null=True) my view: class Loan(LoginRequiredMixin,ListView): query_set =Loan.objects.filter(status="active",action="creating loan").select_related('staff','search_client') context_object_name = 'transactions' paginate_by = 15 my template: duplicates am getting: duplicates in the toolbar -
Django how to create child record with parent id
I am trying to link the accounts table with the user table using the Foreigkey field. Inside my model, I have Account class. class Account(models.Model): account_number = models.CharField(max_length=30) account_type = models.CharField(max_length=20) user = models.ForeignKey(User, related_name='accounts', on_delete=models.CASCADE) Below is my serializers.py class AccountSerializer(serializers.ModelSerializer): class Meta: model = Account fields = ('id', 'account_number', 'account_type') class UserSerializer(serializers.ModelSerializer): accounts = AccountSerializer(many=True) class Meta: model = User fields = ('id', 'first_name', 'last_name', 'email', 'password', 'accounts') extra_kwargs = {'password': {'write_only': True, 'required': True}} In my view.py, I created AccountViewSet class AccountViewSet(viewsets.ModelViewSet): queryset = Account.objects.all() serializer_class = AccountSerializer I am trying to insert an account record with a user id using Postman, I am getting the following error message. django.db.utils.IntegrityError: null value in column "user_id" of relation "app_account" violates not-null constraint DETAIL: Failing row contains (7, 0187898789, Saving, null). I already have a user record with id 1 in the database, and in postman, I did pass the user_id. However, when I try to print the validated_data it doesn't show the user_id -
django iterate through model objects that contain another particular model object in a ManyToManyField
I have the following models in my django app. class author(models.Model): name=models.CharField(max_length=100) class book(models.Model): name=models.TextField() authors=models.ManyToManyField(author) A author definately have written multiple books. A single book can also have multiple authors. I want to iterate through all books by a particular author. Till now I have tried for b in book.objects.filter(authors__name='HiDe'): print(b) which gives AttributeError: 'function' object has no attribute 'objects' probably because authors in book is a ManyToManyField. Adding books=models.ManyToManyField(author) will make the database large and cumbersome to manage as an author can have too many books, so this is not the solution I want. -
AJAX only updates a single django model instance
I have a django project that shows a list of "issue" objects, and each issue object has a boolean field called "fixed". I want the user to be able to press a button that will change "fixed" using ajax, but the button only changes one of the issue objects rather than whatever "issue" that button belongs to, here's a gif of my problem Here is my html: {% for issue in projects.issues.all %} <article class="media content-section"> <img class="rounded-circle article-img" src="{{ issue.author.profile.image.url }}"> <div class="media-body"> <div class="article-metadata"> <a class="mr-2">{{ issue.author }}</a> <small class="text-muted">{{ issue.date_posted|date:"F d, Y" }}</small> </div> <h2><a class="article-title" href="{% url 'issue-detail' issue.id %}">{{ issue.title }}</a></h2> <p class="article-content">{{ issue.description }}</p> <p>{{ issue.severity }}</p> {% if projects.author == user %} <span id="fixed_bool">{{ issue.fixed }}</span> {% csrf_token %} <button class = "btn btn-primary btn-sm" id="fix-button" value = "{{ issue.id }}">Fix</button> {% endif %} </div> </article> {% endfor %} Javascript: $(document).on('click', '#fix-button', function (e) { e.preventDefault(); $.ajax({ type: 'POST', url: '{% url "fix_issue" %}', data: { issueid: $('#fix-button').val(), csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]').val(), action: 'post' }, success: function (json) { document.getElementById("fixed_bool").innerHTML = json['result'] console.log(json) }, error: function (xhr, errmsg, err) { } }); }) my url path('fix/', views.FixView, name='fix_issue'), and my views def FixView(request): if request.POST.get('action') … -
[Dokcer]python3: can't open file '/app/manage.py': [Errno 2] No such file or directory
I'm new to docker, and I tried to run django on the docker container. However, after I ran the "docker-compose up -d" command the error python3: can't open file '/app/manage.py': [Errno 2] No such file or directory shows in docker. Since it seems that the code can be run successfully in mac os, I doubt if it is the problem of Windows11 which I run the file currently. My questions are: 1.Why the this error happens? 2.How I can fixed it? The dockerfile: FROM python:3 ENV PYTHONUNBUFFERED 1 RUN mkdir /app WORKDIR /app COPY requirements.txt /app/ RUN pip install -r requirements.txt COPY . /app/ the docker-compose file version: '3' services: web: build: . command: python3 manage.py runserver 0.0.0.0:8000 volumes: - .:/app ports: - "8000:8000" depends_on: - db I've tried to solve the problem for hours, but the solutions I searched did not work. Hope someone can help. Thank you very much!! -
Finding 2 values if available in a list in a Django Template
I have the following list called `` :[(2, 'Flat Bench'), (1, 'Flat Bench'), (3, 'Flat Bench')] I am trying to find if the b.order which is the first number and e.name which is the 2nd string is available from a django template. In my trial I made sure that b.order is equal to 2 and e.name is 'Flat Bench'. Here is the django template: {% if b.order and e.name in all_logs %} available {% else%} not available {% endif %} In my case there is no error, it is just always showing not available even if it is available. I am not sure what change I should be doing to get this code to work. -
How to populate a model's foreignkey field from another model instance's foreignkey field
I have the models: Recipe, Ingredient, and Cart. I'll have 2 types of Users: Cooks and Eaters. Cooks create Recipe posts and include the Ingredients for each Recipe. Ingredients are mapped to Products I want the Eaters, as they're on the recipe_detail.html, to have their Cart pre-populated with all the Products referenced in the Ingredient list associated with the Recipe currently being visited. Here's my code: #ingredients/models.py class Product(models.Model): name = models.CharField(max_length=255) class Ingredient(models.Model): recipe = models.ForeignKey(Recipe,on_delete=models.CASCADE, blank=True, related_name='ingredients') product = models.ForeignKey(Product,on_delete=models.CASCADE, blank=True) #cart/models.py class Cart(models.Model): owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='products') #cart/views.py class CartCreateView(CreateView): model = Cart template_name = "recipes/recipe_detail.html" form_class = CartModelForm def dispatch(self, request, *args, **kwargs): """ Overridden so we can make sure the `Recipe` instance exists before going any further. """ self.recipe = get_object_or_404(Recipe, pk=kwargs['Recipe_id']) return super().dispatch(request, *args, **kwargs) def form_valid(self, form): """ Overridden to add the recipe relation to the `Ingredient` instance. """ ingredients = self.recipe.ingredient.all() form.instance.owner = self.request.user.pk form.instance.product = None # <---- The problem return super(CartCreateView, self).form_valid(form) #recipe_detail.html <!-- Recipe --> <div> <h2>{{ recipe.title }}</h2> <p>By: {{ recipe.owner }}</p> </div> <!-- Ingrediants --> <div> <h4>Ingrediant list:</h4> <ul> {% for ingrediant in recipe.ingrediants.all %} <li>{{ ingrediant }} {{ ingrediant.context }} {% … -
How to get values of a dictionary in a Django Template without for loop
I am trying to get a value of a dictionary in a Django Template. I am not sure whether this is possible or not. Here is the following template: {{ active_session.log.values }} This is the print out of it: <QuerySet [{'id': 318, 'log_order': 1, ......other repeated keys and values}> My question how can get all the values of the log_order with going through a for loop in the template knowing that it is a many to many relationship. Here is the models: class Log(models.Model): ................................... log_order = models.IntegerField(validators=[MinValueValidator(1)],blank=True, null=True) class ActiveSession(models.Model): log = models.ManyToManyField(Log, related_name='savedlogs') .................................. here is the views: class workout_details(DetailView): model = Workout template_name = 'my_gym/start_workout.html' context_object_name = 'workout' def get_context_data(self, **kwargs): exercises = Exercise.objects.filter(workout_id=self.object) p = Log.objects active_session = ActiveSession.objects.get(id=ActiveSession.objects.last().id) context = super().get_context_data(**kwargs) context['exercises'] = exercises context['form'] = LogForm() context['p'] = p context['active_session'] = active_session return context There are several answers out there saying that can create a function lookup but it got me an error Failed lookup for key [log_order] in <django.db.models.fields.related_descriptors.create_forward_many_to_many_manager.<locals>.ManyRelatedManager object at 0x046FE4A8> Here is the function in the models: @register.filter(name='lookup') def lookup(value, arg): value_dict = ast.literal_eval(value) return value_dict.get(arg) Here is the template: {{ mydict|lookup:active_session.log.log_order }} -
Django: Error when running python manage.py collectstatic - SuspiciousFileOperation
I'm preparing to deploy a Django application with a React frontend to Heroku. When I run python manage.py collectstatic, I receive the following error: raise SuspiciousFileOperation(django.core.exceptions.SuspiciousFileOperation: The joined path (/Users/x/Desktop/x/_code/app/static/media/SourceCodePro-Light.77e36241fe57a40a332a.otf) is located outside of the base path component (/Users/x/Desktop/x/_code/app/staticfiles) I've followed the Django documentation on configuring django.contrib.staticfiles for deployment. The relevant settings in settings.py: BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = False ... STATIC_URL = 'static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'build/static'), ] STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') As I understand it, the STATICFILES_DIRS setting directs Django where to look for additional static files to collect in the STATIC_ROOT. And the error I'm receiving appears to be because the joined path is not contained within the base path. The problem is that, if this is the case, I don't understand why the base path component does not refer to BASE_DIR, i.e. /Users/x/Desktop/x/_code/app/. I've tried every permutation of adding/removing slashes in every path in the relevant settings, as well as setting STATIC_ROOT = BASE_DIR. Actually, no matter what I change STATIC_ROOT to, I receive the same error and the /Users/x/Desktop/x/_code/app/staticfiles folder is still generated. This leads me to believe that my setting is being overriden somewhere. Thank you in advance for any solutions provided. -
Erro File "manage.py", line 17 ) from exc ^ SyntaxError: invalid syntax
Estou há horas tentando seguir o tutorial para criar um app no Django mas esse erro insiste. Eu não consigo de forma alguma executar o comando python manage.py makemigrations + (nome do app). Fica acusando esse erro de line 17 syntax error, me estressando isso. Era para ser um framework façil de se usar. Alguém por favor me ajude com isso porque não sei mais o que fazer. -
How to test django non-REST POST endpoint?
I'm having trouble testing one of my endpoints: @require_http_methods(["POST"]) def store(request): try: body_unicode = request.body.decode('utf-8') body = ast.literal_eval(body_unicode) new_short_url = body['short_url'] original_url = body['original_url'] check_parameters(new_short_url, original_url) Url.objects.create(short_url=new_short_url, original_url=original_url) return HttpResponse('Created', status=201) except KeyError as error: return HttpResponse('Missing {}'.format(error.args), status=400) except (AttributeError, IntegrityError, ValidationError) as error: return HttpResponse(error.args, status=400) As you can see, this endpoint only accepts POST requests and when trying to pass data from my tests, it arrives in the request.body, so I implemented my logic to get the data from there: def test_create_url_ok(self): creation_data = { "short_url": "ab", "original_url": "https://stackoverflow.com/" } response = self.client.post(reverse('store'), data=creation_data, content_type="application/json") self.assertEqual(response.status_code, 201) This works, but the problem is that when sending requests from my templates, data is not in the request.body, but in the request.POST. How to send data in the request.POST from my tests? -
way to find in module
I have a Django module called Section with Sections called Primary, Junior, and Secondary, and each class has some number of classes. My question here is how can I print a sing class in a particular section using Django. -
Pylint errors in Django, Pylint(E0611:no-name-in-module) and Pylint(E1101:no-member)
It seems like my models.py, forms.py, urls.py and views.py are not recognizing the elements in each other and I don't understand what could be going wrong. I'm just starting the project (CS50W Project4-Network) and I noticed the problem when I tried to render the model form and the textarea field of the form linked to the model wouldn't show on the browser, it only shows when I click submit, as a missing field to be filled, I'm not sure if its because of the same pylint errors I'm getting or something else. Here is my models: from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): pass class Post(models.Model): body = models.TextField() date = models.DateTimeField(auto_now_add = True) author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="author", default=None) def __str__(self): return f"{self.body} by {self.author} at {self.date}" The forms.py: from django import forms from django.forms import ModelForm from .models import Post class PostForm(ModelForm): class Meta: model = Post fields = ["body"] widgets = { "body": forms.Textarea(attrs={'class': 'form-control col-md-5 col-lg-6'}), } The views from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.db import IntegrityError from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from .forms import PostForm from .models import … -
I have a problem: ERROR: Could not find a version that satisfies the requirement kivy-deps.angle==0.3.2 (from versions: none)
I just loading my django project to Heroku, but i have this problem, what can i make? remote: ERROR: Could not find a version that satisfies the requirement kivy-deps.angle==0.3.2 (from versions: none) remote: ERROR: No matching distribution found for kivy-deps.angle==0.3.2 -
How to fetch data remotely for displaying into admin/index.html in django adminlte v3
In Django AdminLte3, I want to show custom dashboard along with others Admin models. The data of the dashboard will come from remote server. And my custom dashboard will open by localhost:8000/admin/. How can I achieve this. Thanks in advance for any suggestion. -
How to do different registration forms according to User type. User type should be established before registration itself
I am trying to make different registration forms according to different User types. I`ve created a custom User, which can be either Customer or Seller, like this: class CustomUser(AbstractBaseUser, PermissionsMixin): class UserTypeChoices(models.TextChoices): Customer = 'Customer', _('Customer') Seller = 'Seller', _('Seller') type = models.CharField( max_length=8, choices=UserTypeChoices.choices, ) My idea is that at first, a person, who visites my website should choose his type, and after that he can register according to it`s type. Sellers should have phone numbers as USERNAME_FIELD, while Customers should have email. I know that I will have to write custom backend for this thing, yet still this is what I want to do. I`ve decided to do two different forms for this: First one with only type field, which should redirect to a form with normal registration. This first form looks like this: class UserTypeForm(UserCreationForm): class Meta: model = get_user_model() fields = ["type"] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if self._meta.model.USERNAME_FIELD in self.fields: self.fields[self._meta.model.USERNAME_FIELD].widget.attrs[ "autofocus" ] = True del self.fields["password1"] del self.fields["password2"] def save(self, commit=True): user = super().save(commit=False) return user And here is where I`ve stopped right now, as it gives me: Traceback (most recent call last): File "D:\Python\Hillel\VolunteeringHub\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File … -
I have an error when i put my django project on Heroku: ERROR: Could not install packages due to an OSError: [Errno 2]
i don't want this package in my project, how can i skip him? Or what can i make? remote: -----> Installing requirements with pip remote: Processing /D:/Python/mymodules/dist/vsearch-1.0.tar.gz remote: ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/D:/Python/mymodules/dist/vsearch-1.0.tar.gz' -
how to backend service with neo4j and django
How do I have to connect neo4j in django? I'm using Python 3, so how to write a service?. I'm new to both of them and at the moment I'm a little confused. thank you guys.