Re: Manage.py not working

2020-06-23 Thread Oleg Kishenkov
Hello, please follow this tutorial https://www.jetbrains.com/help/pycharm/creating-django-project.html, instead of MyDjangoProject type test1. Make sure a virtual environment is created for your project (step 1). Then go to Tools -> Run manage.py Task (or press Ctrl+Alt+r), type startapp app1 i

Re: Custom Primary Key

2020-06-23 Thread Oleg Kishenkov
Hello Soumen, you should use a CharField with the primary_key=True attribute for your model. This way no no automatic primary key field is generated, your field will be implicitly unique and non-null though. Only one primary key is allowed in a model. class Foo(models.Model) id = models.Cha

Re: Custom Primary Key

2020-06-24 Thread Oleg Kishenkov
wouldn't change, another record would be created with the new id foo = Foo.objects.filter(id=id)[0] foo.id = 'X1Y2Z3' foo.save() Foo.objects.all() , ]> Oleg среда, 24 июня 2020 г. в 04:49:45 UTC+3, Clive Bruton: > > On 23 Jun 2020, at 23:32, Oleg Kishenkov wrote: &g

Re: Django queryset filtering

2020-06-25 Thread Oleg Kishenkov
Hello, use a filtering chain, a refined queryset is itself a queryset so you can filter it further. Also, Django has extensive lookup support in its filtering methods. Let's assume LicenseIssue is related to Business as many to one (it is probably the case): class Business(models.Model): name