Problem solved, I had a null value in the db so listing couldnt work..
On Monday, February 4, 2019 at 6:59:09 PM UTC+1, B.navya spoorthi Sweety wrote:
-- On Monday, February 4, 2019 at 6:59:09 PM UTC+1, B.navya spoorthi Sweety wrote:
hi all ,i just started with django. i am following this documenthere database used is sqlite. but i want to try out django+mongodbwhat all changes i can made so that django uses mongodb databasewhere should i create database and use with django.i knew Regular Mongo Db operations
but not able to do from Django
thanks in advance.waiting for a replyOn Mon, Feb 4, 2019 at 5:18 PM Ivan Martić <marti...@gmail.com> wrote:Hi all,--I need help.I keep getting this issue, NoReverseMatch at /Reverse for 'productsgrouping-update' with arguments '('',)' not found. 1 pattern(s) tried: ['update/(?P<url_id>[0-9]+)/$'
] not sure what am doing wrong. Any time I put url tag {% url 'productsgrouping-update' lista.id%} in html i get the error.Both url work as stand alone, /index and /index/update/1/ but when i put url tag all hell break loose.. I strugling for a week now. Thank you all in advance.<view>from django.shortcuts import render, redirectfrom django.http import HttpResponsefrom .models import Material4, MaterialGroupfrom django.db import connectionfrom .forms import ProductgroupinputForm, MaterialGroupFormfrom django.conf import settingsdef productsView(request):lista = MaterialGroup.objects.all()#text5 = MaterialGroup.objects.get(id=url_id) #return redirect(reverse('productsgrouping_update', kwargs=('id':url_id))) return render(request, "productsgroup.html", {"lista" : lista})def productsUpdateView(request, url_id):text5 = MaterialGroup.objects.get(id=url_id) form5 = ProductgroupinputForm(request.POST or None, instance=text5) context1 = {'text5': text5,'form5': form5}if form5.is_valid():form5.save()return render(request, 'productsgroup-update.html', context1)<url>from django.urls import pathfrom . import viewsurlpatterns = [path('', views.productsView, name='productsgrouping'),path('update/<int:url_id>/', views.productsUpdateView, name='productsgrouping-update'), ]<main url>from django.contrib import adminfrom django.urls import path, includefrom django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = [path('admin/', admin.site.urls),path('', include('product.urls')),]<model>from __future__ import unicode_literalsfrom django.db import models, connectionfrom django.utils import timezonefrom datetime import datefrom django.urls import reverseclass Material4(models.Model):id = models.IntegerField(db_column='ID', primary_key=True, blank=False, unique=True) bukrs = models.CharField(db_column='BUKRS', max_length=3) materialid = models.CharField(db_column='MaterialID', max_length=50) maktx = models.CharField(db_column='MAKTX', max_length=150) input_group = models.IntegerField(db_column='Input_group') class Meta:managed = Falsedb_table = 'Material4'def __str__(self):return '%s %s %s %s' % (self.id, self.materialid, self.maktx, self.input_group)<forms>from django import formsfrom .models import Material4, MaterialGroupclass ProductgroupinputForm(forms.ModelForm): class Meta:model = Material4fields = ['materialid', 'input_group', 'id', 'input_group']class MaterialGroupForm(forms.ModelForm): class Meta:model = MaterialGroupfields = ['material_group', 'id']
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0f15b6d9- .4dec-4ef9-b79a-643fc37a8781% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/38c421e7-cbda-4399-9e9a-e3f3a92ab31c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment