Re: Categories and shoe Subcategories according to the parent category.

2020-05-19 Thread Antje Kazimiers
you could have a field "parent" in your Model Category which is a ForeignKey to Category itself, so Category is a self-referencing table. Then in your first dropdown you only show those entries where parent is None and in your second one where parent == accessories. you need to get this right

Re: How to use ModelChoiceField? I whould like to filter the output from a field form.

2020-04-29 Thread Antje Kazimiers
Field('number of order',max_length=100) >  date_create =models.DateTimeField(auto_now=True) >  name =models.ForeignKey(Customer,on_delete > =models.CASCADE,verbose_name='customer',null=True) >  name_order =models.CharField('name of order',max_length=200) > | > > > вторник, 28 апреля 2020 г

Re: How to use ModelChoiceField? I whould like to filter the output from a field form.

2020-04-28 Thread Antje Kazimiers
the form doesn't know the request only the view does. how does your view function look like? On 4/28/20 5:57 PM, Sergei Sokov wrote: > я не совсем понял > > | >     class Meta: >         model = Order >         fields = '__all__' >     name_job = forms.ModelMultipleChoiceField(queryset=None) >    

Re: How to use ModelChoiceField? I whould like to filter the output from a field form.

2020-04-28 Thread Antje Kazimiers
qs = TypJob.objects.filter(author__id=user.id) needs to go inside of the __init__ function. you pass user = request.user as a parameter to OrderTestForm when you instantiate it in your view and can use it then in your init function. Also you can only filter the id of the author if the author

Re: The database backend does not accept 0 as a value for AutoField.

2020-04-26 Thread Antje Kazimiers
lueError:Thedatabase backend does notaccept 0asa value forAutoField. > | > > guys help me with this error . > > > On Sunday, April 26, 2020 at 9:10:41 PM UTC+5:30, Antje Kazimiers wrote: > > setting default=False is odd for any field other than a > BooleanField. I woul

Re: The database backend does not accept 0 as a value for AutoField.

2020-04-26 Thread Antje Kazimiers
setting default=False is odd for any field other than a BooleanField. I would take that out for the OneToOneField at least and see how things go. Antje On 4/26/20 4:19 PM, Mayur Bagul wrote: > Hello guys, > > im stucked with this error mentioned in subject. > below link redirect details about

Re: Problem in polls app(ques text will not display)

2020-04-21 Thread Antje Kazimiers
It sounds like your database is empty. Did you check if there are any Question records in your admin view? Under 127.0.0.1:8000/admin You should see an entry for Questions and you can create question records there. Here they describe, how to create those records using the django management

Re: Models as choices

2020-04-16 Thread Antje Kazimiers
with a Foreign Key field, one-to-many relationship: https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ Antje On 4/16/20 6:52 AM, shreehari Vaasistha L wrote: > how can i use model x values as choices for model y ? > > for eg: > | > classcountries(models.Model): >  country

Re: Django - PrePopulate the Foreign Key on the web page, and use that id to save the model.

2020-04-13 Thread Antje Kazimiers
ll default display as > -- with only one required project name. > > Thanks & Regards, > - > Mayank Tripathi > Mo. +1 615 962 2128 > "Do what you can, with what you have, where you are -by Theodore > Roosevelt" > https://datascience.foundation/data

Re: Django - PrePopulate the Foreign Key on the web page, and use that id to save the model.

2020-04-12 Thread Antje Kazimiers
Hi, I think in your view modulesView() you need to pass the project id to ModuleForm: .. else : form = ModuleForm(projectid) .. and then you need to overwrite the constructor of ModuleForm by adding an __init__ function: def __init__(self, projectid=None, *args, **kwargs):

Re: how to use django template language inside script html tag using django-jsRender

2020-04-03 Thread Antje Kazimiers
I think you can use some basic template language within a script block like below. myData is a stringified json object, that worked for me. antje {% if myData %} var table_data = {{ myData|safe }}; {% else %} var table_data = null; {% endif %} On Fri, Apr 3, 2020 at 4:00 PM

Re: Issue with passing parameters in urls

2020-04-01 Thread Antje Kazimiers
Hi Aniket, Your thread object in your template is actually a message since your passing messages to context in your view. but when you initialize messages you don't set a name attribute. So I would double check your Message model if it has a name attribute. btw your error message didn't

Re: Django Login Problem

2020-03-29 Thread Antje Kazimiers
Hi, It sounds like you don't get an error message, so maybe your authenticate method in def sign_in(request) just returns a None user and you get redirected. I would find this method in your django installation, for me it's in the env folder but that depends on your setup:

Re: Django mail

2020-03-22 Thread Antje Kazimiers
Couldn't you also set up cron jobs to check for some conditions you have to come up with, which are using the fields of your User model like date_joined and check, if fields of your user profile are filled in with respect to the created date of your profile? I would start with writing some django

Re: Custom User

2020-03-06 Thread Antje Kazimiers
Hi Kushal, Since the out-of-the box User model is coming from the auth module, you can hardly extend this class. To store additional information for different types of Users, you could create a custom UserProfile model, which has a Foreign Key to the User model: from django.db import models ...

Re: Error with filter queryset

2020-02-09 Thread Antje Kazimiers
Hi Chuck, Status in your example is not a text field, but a Foreign Key, that means a reference to a record in another table Task_Status, you see that here: Status = models.ForeignKey(Task_Status, on_delete=models.CASCADE) You need to filter on the attribute within Task_Status, which has

Re: Can't find image files

2020-01-27 Thread Antje Kazimiers
Hi, I keep my images files within in a static folder, so ./MyProject/static/media/myimage.png would be my path. In the template I make use of it like that: It's explained here: https://docs.djangoproject.com/en/3.0/howto/static-files/ also that you need to define your static folder in your

Re: How to run the django development environment?

2020-01-26 Thread Antje Kazimiers
If you want to contribute to django, this README has detailed step-by-step instructions to get the environment running and links to find tickets to work on: https://github.com/carltongibson/dcus2019sprints#getting-set-up-with-the-code It's been written by Carlton Gibson, who gave a talk about

Re: Django Design Patterns

2019-11-17 Thread Antje Kazimiers
Hi Fatjon, I wonder how much you can try finding that out on your own by just grepping for the names of the common Gang of Four [1] - design patterns in the django source code. I just tried Observer, Factory and find examples in the code, which sound like the developer really followed the