hi all ,
i just started with django. i am following this document
here database used is sqlite. but i want to try out django+mongodb
what all changes i can made so that django uses mongodb database
where 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 reply
On Mon, Feb 4, 2019 at 5:18 PM Ivan Martić <martic.ivan@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_urlpatternsurlpatterns = [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+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/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/CAOdZuzz7K4WHEPKJtg38u%3DbEAeRagVQcOx82kqdmoWwmM0XEvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment