skip to Main Content

Return a list of options only if they exist in two Django Models – Postgresql

I have two models in my models.py file: Flavour model: class Flavour(models.Model): flavour_choice = models.CharField(null=True, blank=True, max_length=254) def __str__(self): return self.flavour_choice and Product model: class Product(models.Model): category = models.ForeignKey( 'Category', null=True, blank=True, on_delete=models.SET_NULL ) slug = models.SlugField() sku = models.CharField(max_length=254,…

VIEW QUESTION

Using jquery POST request to save form in django

here my form.html in this form I'm use Django model form. <div class="container"> <form action="{% url 'add_product' %}" id="product_form" method="POST" enctype="multipart/form-data"> {% csrf_token %} <div class="row"> <div class="col-sm-12"> <label for="">{{form.code.label}} :</label> {{form.code}} <span id="error">{{form.code.errors | striptags }}</span> </div> <div class="col-sm-12">…

VIEW QUESTION

Unable to link my django to mysql database (Form)

can someone help me with my code? Why is it not working? My views.py def register(request): if request.method == 'POST': form = RegisterForm(request.POST) if form.is_valid(): fullname = form.cleaned_data.get('fullname') emailaddress = form.cleaned_data.get('emailaddress') password = form.cleaned_data.get('password') form.save() return redirect('/') else: form =…

VIEW QUESTION

nginx dot'n static in django project

After settings nginx in server static has disappeared from the site. If you work only with gunicorn, all everything is successful. Command "python manage.py collectstatic " executed : 440 static files copied to '/home/v_n_kich/Project_LAWboard/static'. settings.py STATIC_URL = '/static/' STATIC_ROOT =…

VIEW QUESTION
Back To Top
Search