hi all ,
i just started with django. i am following this document
https://docs.djangoproject.com/en/2.1/intro/tutorial01/
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.i...@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, redirect
> from django.http import HttpResponse
> from .models import Material4, MaterialGroup
> from django.db import connection
> from .forms import ProductgroupinputForm, MaterialGroupForm
> from django.conf import settings
>
> def 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 path
> from . import views
>
> urlpatterns = [
>     path('', views.productsView, name='productsgrouping'),
>     path('update/<int:url_id>/', views.productsUpdateView,
> name='productsgrouping-update'),
> ]
>
> *<main url>*
> from django.contrib import admin
> from django.urls import path, include
> from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>
> urlpatterns = [
>     path('admin/', admin.site.urls),
>     path('', include('product.urls')),
> ]
>
>
> *<model>*
> from __future__ import unicode_literals
> from django.db import models, connection
> from django.utils import timezone
> from datetime import date
> from django.urls import reverse
>
> class 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 = False
>         db_table = 'Material4'
>
>     def __str__(self):
>     return '%s %s %s %s' % (self.id, self.materialid, self.maktx,
> self.input_group)
>
>
> *<forms>*
> from django import forms
> from .models import Material4, MaterialGroup
>
> class ProductgroupinputForm(forms.ModelForm):
>
>     class Meta:
>         model = Material4
>         fields = ['materialid', 'input_group', 'id', 'input_group']
>
> class MaterialGroupForm(forms.ModelForm):
>
>     class Meta:
>         model = MaterialGroup
>         fields = ['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+unsubscr...@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
> <https://groups.google.com/d/msgid/django-users/0f15b6d9-4dec-4ef9-b79a-643fc37a8781%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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+unsubscr...@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.

Reply via email to