Questions tagged [django-3]
10 questions
3
votes
2 answers
Django url path migration (1.11->3.1) warning for route symbols
I'ved got this warning in Django 3.1.5 when doing the migration from 1.11
?: (2_0.W001) Your URL pattern 'employee/attendanceactivity/attendance/(?P\d+)/' [name='employee-attendanceactivity-detail'] has a route that contains '(?P<',…

Axil
- 3,606
- 10
- 62
- 136
2
votes
0 answers
django-3 Object of type PosixPath is not JSON serializable
How to build a serializer that converts the PosixPath property into a string? I tried:
class ObjSerializer(serializers.ModelSerializer):
class Meta():
model = MyObject
fields = ('slug', 'name', 'path')
name =…

Soerendip
- 7,684
- 15
- 61
- 128
1
vote
0 answers
Django empty list when using ModelChoiceField
First of all, I'm new to Django or MVC frameworks in general and I've got quite little experience in Python.
I've read stackoverflow threads with similar title, but yet I'm missing some puzzle piece.
After trying for some time, this is what I ended…

RiddleMeThis
- 817
- 1
- 6
- 10
1
vote
1 answer
Django SearchVector doesn't work with search query containing whitespace
I have a name field on which I am trying to annotate with a SearchVector. It works fine if I don't add a whitespace in search string but returns empty list if I add a whitespace.
Same string works just fine with regular filter queryset.
>>> r =…

MohitC
- 4,541
- 2
- 34
- 55
1
vote
1 answer
Django Foreign key to not loaded object
Hello I have a problem that I want to link foreign key to model's related object in other words I want to link foreign key to not loaded object's fields.
class Category(models.Model):
...
filter_option_content_type =…

Kriptos
- 11
- 2
0
votes
1 answer
How to access auth_user_group table by ID
How can I directly specify the ID column of auth_user_group table in queries/DML?
I am referring to auth_user_group.id, not auth_group.id nor auth_user_group.group_id.
For example, I want to directly issue DML like:
delete from auth_user_group where…

Matthew Moisen
- 16,701
- 27
- 128
- 231
0
votes
1 answer
Run a function after django server has started
I want to run a function after django server has started. Now, that function should run after all the views and URLs are initialized because the function might make requests to one of the registered routes.

Shubh Parmar
- 27
- 2
- 6
0
votes
1 answer
Django3: accounts/password_reset does not use admin.site.site_header
I have an app
main/
├── asgi.py
├── celery.py
├── __init__.py
├── settings.py
user/
├── admin.py
├── apps.py
├── __init__.py
├── migrations
│ ├── 0001_initial.py
│ ├── ...
├── models.py
├── tests.py
├── urls.py
└── views.py
In admin.py the…

Soerendip
- 7,684
- 15
- 61
- 128
0
votes
1 answer
Django3: How to setup OneToOneField that works with inline admin correctly?
I would like to create a pipeline instance and create the corresponding input file together. My models I have a structure like this.
class Pipeline(models.Model):
input_file = models.OneToOneField(
'InputFile',
…

Soerendip
- 7,684
- 15
- 61
- 128
-2
votes
2 answers
Dango3: Setting up OneToOne relationships correctly
I want to generate several related Model objects at once that are linked in the model view via stacked.Inline. I can create the objects in the admin view. However, when I go to the list view of the pipeline model I get:
'Pipeline' object has no…

Soerendip
- 7,684
- 15
- 61
- 128