Re: Best and affordable payment gateway for shopping carts

2021-03-24 Thread MUGOYA DIHFAHSIH
In my current project i implemented Cash On Delivery method, I hope it
would be also suitable for your project too.

On Tue, 23 Mar 2021 at 20:42, JC Briar  wrote:

> Stripe.com
>
> On Tuesday, March 23, 2021 at 6:00:58 AM UTC-7 ram.mu...@gmail.com wrote:
>
>> Hi,
>>
>> We are exploring best payment gateway for a Django based web and mobile
>> application. Our criteria for choosing this payment gateway is like  this:
>>
>> 1. Looking for either affordable or free option
>>
>> 2. Suitable for users in North America
>>
>> 3. Support all type of credit cards
>>
>> 4. Compatible for Django web an mobile application
>>
>> If anyone has already implemented for Django applications could you share
>> you suggestions?
>>
>> Best Regards,
>> ~Ram
>>
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/31d10a80-394a-450b-a127-4798adde357dn%40googlegroups.com
> 
> .
>


-- 
Mugoya Dihfahsih
Software Engineer
RCS Consult
Kampala, Uganda
M: +256 751612792 I +256 779839581
E: i...@rcsconsult.net 
W: www.rcsconsult.net

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DJD9yh%3DsNejxi7ZkEg-HoWbdz2Dan5uew%3D4%3DQd_7%2BOGeoqZg%40mail.gmail.com.


Django application is slow

2021-03-24 Thread Israr Hussain Rao
Dear Programmers,
my Django application is big and slow any leads on how to make it fast
responsive.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%2B6t01mtTdMf5hRT%3DHbrPDK4H7j5%2B0v3bWbYmUjHicNkyu-zQ%40mail.gmail.com.


Re: Django application is slow

2021-03-24 Thread Omkar Parab
Check, if your server is capable of handling huge requests or not.
Remove unused JavaScript. Check your querysets.


On Wed, Mar 24, 2021, 1:31 PM Israr Hussain Rao <
israrhussainrao5...@gmail.com> wrote:

> Dear Programmers,
> my Django application is big and slow any leads on how to make it fast
> responsive.
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%2B6t01mtTdMf5hRT%3DHbrPDK4H7j5%2B0v3bWbYmUjHicNkyu-zQ%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJY8mfy86X8_gN%3DCAoEQu1krv3L_9DvHRjH_Hrb1qS8hbfbt4g%40mail.gmail.com.


Re: Django application is slow

2021-03-24 Thread Israr Hussain Rao
  I have rechecked my code and did my best to shorten the code and
removed unused javascript as well.
I will recheck my server capability as well. do you know about the Django
cache technique? how can i use it?




On Wed, Mar 24, 2021 at 10:17 AM Omkar Parab  wrote:

> Check, if your server is capable of handling huge requests or not.
> Remove unused JavaScript. Check your querysets.
>
>
> On Wed, Mar 24, 2021, 1:31 PM Israr Hussain Rao <
> israrhussainrao5...@gmail.com> wrote:
>
>> Dear Programmers,
>> my Django application is big and slow any leads on how to make it fast
>> responsive.
>>
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAP%2B6t01mtTdMf5hRT%3DHbrPDK4H7j5%2B0v3bWbYmUjHicNkyu-zQ%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJY8mfy86X8_gN%3DCAoEQu1krv3L_9DvHRjH_Hrb1qS8hbfbt4g%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%2B6t03zkT%3DY2Sk6267vaBZEpMfjL4NOfdW2dtJ%3DYqS_ER-NQA%40mail.gmail.com.


Re: Django application is slow

2021-03-24 Thread Omkar Parab
Django documentation 👇
https://docs.djangoproject.com/en/3.1/topics/cache/

On Wed, Mar 24, 2021, 1:52 PM Israr Hussain Rao <
israrhussainrao5...@gmail.com> wrote:

>   I have rechecked my code and did my best to shorten the code and
> removed unused javascript as well.
> I will recheck my server capability as well. do you know about the Django
> cache technique? how can i use it?
>
>
>
>
> On Wed, Mar 24, 2021 at 10:17 AM Omkar Parab 
> wrote:
>
>> Check, if your server is capable of handling huge requests or not.
>> Remove unused JavaScript. Check your querysets.
>>
>>
>> On Wed, Mar 24, 2021, 1:31 PM Israr Hussain Rao <
>> israrhussainrao5...@gmail.com> wrote:
>>
>>> Dear Programmers,
>>> my Django application is big and slow any leads on how to make it fast
>>> responsive.
>>>
>>>
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAP%2B6t01mtTdMf5hRT%3DHbrPDK4H7j5%2B0v3bWbYmUjHicNkyu-zQ%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJY8mfy86X8_gN%3DCAoEQu1krv3L_9DvHRjH_Hrb1qS8hbfbt4g%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%2B6t03zkT%3DY2Sk6267vaBZEpMfjL4NOfdW2dtJ%3DYqS_ER-NQA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJY8mfw88FUnKQom%3DjM10M_P%3DmNLX5wkgZnkeBFnf-v9d9TzGw%40mail.gmail.com.


Re: Django application is slow

2021-03-24 Thread Israr Hussain Rao
I am trying this but i am coınfused either i have to make a
separate function or i have to just install Memcache and add the
cahe binding to the settings




On Wed, Mar 24, 2021 at 10:38 AM Omkar Parab  wrote:

> Django documentation 👇
> https://docs.djangoproject.com/en/3.1/topics/cache/
>
> On Wed, Mar 24, 2021, 1:52 PM Israr Hussain Rao <
> israrhussainrao5...@gmail.com> wrote:
>
>>   I have rechecked my code and did my best to shorten the code and
>> removed unused javascript as well.
>> I will recheck my server capability as well. do you know about the Django
>> cache technique? how can i use it?
>>
>>
>>
>>
>> On Wed, Mar 24, 2021 at 10:17 AM Omkar Parab 
>> wrote:
>>
>>> Check, if your server is capable of handling huge requests or not.
>>> Remove unused JavaScript. Check your querysets.
>>>
>>>
>>> On Wed, Mar 24, 2021, 1:31 PM Israr Hussain Rao <
>>> israrhussainrao5...@gmail.com> wrote:
>>>
 Dear Programmers,
 my Django application is big and slow any leads on how to make it fast
 responsive.



 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAP%2B6t01mtTdMf5hRT%3DHbrPDK4H7j5%2B0v3bWbYmUjHicNkyu-zQ%40mail.gmail.com
 
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJY8mfy86X8_gN%3DCAoEQu1krv3L_9DvHRjH_Hrb1qS8hbfbt4g%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAP%2B6t03zkT%3DY2Sk6267vaBZEpMfjL4NOfdW2dtJ%3DYqS_ER-NQA%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJY8mfw88FUnKQom%3DjM10M_P%3DmNLX5wkgZnkeBFnf-v9d9TzGw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%2B6t00i_mmTgAh-wx0M30otv6UR-NCL31sEQ6Fdbm0TE%3DRnKA%40mail.gmail.com.


Re: Best and affordable payment gateway for shopping carts

2021-03-24 Thread pankaj palmate
What about paypal?

On Tue, 23 Mar, 2021, 6:30 pm Ram,  wrote:

> Hi,
>
> We are exploring best payment gateway for a Django based web and mobile
> application. Our criteria for choosing this payment gateway is like  this:
>
> 1. Looking for either affordable or free option
>
> 2. Suitable for users in North America
>
> 3. Support all type of credit cards
>
> 4. Compatible for Django web an mobile application
>
> If anyone has already implemented for Django applications could you share
> you suggestions?
>
> Best Regards,
> ~Ram
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F3KfbG296_XGdQKU5fkfSgcX%2BfcO0Fxj6VeHu59-T%3DQ_A%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPyMU1%2BxzjCZ9kE4e6od0T3H_uU2E3wAfnzW0KpyepCipo%2Bh8g%40mail.gmail.com.


Re: Django application is slow

2021-03-24 Thread Omkar Parab
I haven't tried this yet. so can't tell you much about it.

On Wed, Mar 24, 2021, 2:12 PM Israr Hussain Rao <
israrhussainrao5...@gmail.com> wrote:

> I am trying this but i am coınfused either i have to make a
> separate function or i have to just install Memcache and add the
> cahe binding to the settings
>
>
>
>
> On Wed, Mar 24, 2021 at 10:38 AM Omkar Parab 
> wrote:
>
>> Django documentation 👇
>> https://docs.djangoproject.com/en/3.1/topics/cache/
>>
>> On Wed, Mar 24, 2021, 1:52 PM Israr Hussain Rao <
>> israrhussainrao5...@gmail.com> wrote:
>>
>>>   I have rechecked my code and did my best to shorten the code and
>>> removed unused javascript as well.
>>> I will recheck my server capability as well. do you know about the
>>> Django cache technique? how can i use it?
>>>
>>>
>>>
>>>
>>> On Wed, Mar 24, 2021 at 10:17 AM Omkar Parab 
>>> wrote:
>>>
 Check, if your server is capable of handling huge requests or not.
 Remove unused JavaScript. Check your querysets.


 On Wed, Mar 24, 2021, 1:31 PM Israr Hussain Rao <
 israrhussainrao5...@gmail.com> wrote:

> Dear Programmers,
> my Django application is big and slow any leads on how to make it fast
> responsive.
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%2B6t01mtTdMf5hRT%3DHbrPDK4H7j5%2B0v3bWbYmUjHicNkyu-zQ%40mail.gmail.com
> 
> .
>
 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAJY8mfy86X8_gN%3DCAoEQu1krv3L_9DvHRjH_Hrb1qS8hbfbt4g%40mail.gmail.com
 
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAP%2B6t03zkT%3DY2Sk6267vaBZEpMfjL4NOfdW2dtJ%3DYqS_ER-NQA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJY8mfw88FUnKQom%3DjM10M_P%3DmNLX5wkgZnkeBFnf-v9d9TzGw%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%2B6t00i_mmTgAh-wx0M30otv6UR-NCL31sEQ6Fdbm0TE%3DRnKA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJY8mfzrwZz%3D8S_aORYfOzrh6P3fqnNBv6FfM_2cJ66m7T-Dnw%40mail.gmail.com.


Re: Django application is slow

2021-03-24 Thread Benjamin Schollnick
> Dear Programmers, 
> my Django application is big and slow any leads on how to make it fast 
> responsive. 

In my experience, if the Django application is slow, it’s often related to the 
database either queries, or the database engine is scaled correctly.
(Of course, that’s assuming the computer Django is running on is scaled 
correctly)

To my knowledge Django Debug Toolbar has *NOT* been updated, and I started to 
run into compatibility issues with it.  I have had very limited success with 
SILK, but I don’t think I would recommend it….

What are your queries….?

Wait a sec.  DDT HAS been updated?  It claims to support 3.1.1 now?

Install DDT, and take a look at the Time specifically.  See what queries are 
taking the longest, and try to optimize those specifically.

Also, you do have Indexes on every field that you filter by, right?

- Benjamin



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EA8CE296-A85D-4CD0-A86F-199AED72223C%40schollnick.net.


Re: Django application is slow

2021-03-24 Thread Benjamin Schollnick

> I have checked on the developer tool Waiting (TTFB) is taking 6 seconds. no 
> query is taking long i am sharing a picture of the developer tool response 
> you can have a look.
> 

That’s the devtools from the browser?

That has no visibility to your django queries, etc.  Install Django Debug 
Toolbar, which can monitor how long each section of the django process is 
taking so you can identify what is the real bottleneck.

The Web Browser Devtools can’t tell a dingo’s kidney about how long your 
queries are taking…

What the Web browser devtool is telling you is that the entire process of 
getting the web page is taking 6.01 seconds.

So it could be:

Header is sent from Django
Your Django page has queries embedded, or some other code that starts to run
Slowly each element is streamed to the web browser due to the Query processing 
time
The footer of the web page is sent

That entire process can easily explain the slow processing you are seeing, and 
would match what you are seeing in the WebBrowser Devtool.

Without additional information about your Django setup, we are only guessing.  
DDT can give us some additional insight.

- Benjamin

> 
> 
> 
> 
> On Wed, Mar 24, 2021 at 11:52 AM Benjamin Schollnick 
> mailto:bscholln...@schollnick.net>> wrote:
>> Dear Programmers, 
>> my Django application is big and slow any leads on how to make it fast 
>> responsive. 
> 
> In my experience, if the Django application is slow, it’s often related to 
> the database either queries, or the database engine is scaled correctly.
> (Of course, that’s assuming the computer Django is running on is scaled 
> correctly)
> 
> To my knowledge Django Debug Toolbar has *NOT* been updated, and I started to 
> run into compatibility issues with it.  I have had very limited success with 
> SILK, but I don’t think I would recommend it….
> 
> What are your queries….?
> 
> Wait a sec.  DDT HAS been updated?  It claims to support 3.1.1 now?
> 
> Install DDT, and take a look at the Time specifically.  See what queries are 
> taking the longest, and try to optimize those specifically.
> 
> Also, you do have Indexes on every field that you filter by, right?
> 
>   - Benjamin
> 
> 
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/EA8CE296-A85D-4CD0-A86F-199AED72223C%40schollnick.net
>  
> .
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAP%2B6t01Wi7shjrqg_jM%3DEJzNmcLxYL0tTNGXmLYhv4bg9LEqbw%40mail.gmail.com
>  
> .

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/154D5BAE-CCB4-4DBE-BD21-F25151805A85%40schollnick.net.


Data from form is not being saved in DB

2021-03-24 Thread Герман Свердлов
Hi all!

I'm newbie in Django, still trying to figure out how everything works and 
this is my first back end framework, that I'm using. Currently building an 
app like booking.com but for commercial property. 

Among others I have models that represent office centers and office spaces 
this is one-to-many relationship (1 office, many spaces). I've made a form 
that adds spaces to a particular office, but this form doesn't seem to save 
data.

I'm stuck on the following:
- Am I right that I need to point an action attribute in the form to 
specify view which will save form data into DB? If yes, I'm struggling how 
to do that, because I'm getting errors ReverseMatch
- If this is not about action attr, what am I missing?

Thank you in advance
German

***
models.py
from django.db import models
from django.urls import reverse

class Office(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(max_length=200, unique=True)
image = models.ImageField(null=True, blank=True, upload_to='offices/')
description = models.TextField(max_length=400, blank=True)
address = models.CharField(max_length=200, blank=True)
minprice = models.DecimalField(max_digits=6, blank=True, decimal_places=1)
size = models.IntegerField(blank=True)
worktime = models.CharField(max_length=200, blank=True)

class Meta: 
verbose_name_plural = 'offices'

def get_absolute_url(self):
return reverse("office:office", kwags={'id': self.id})

def __str__(self):
return self.name

class Space(models.Model):
office = models.ForeignKey(
Office, 
on_delete=models.CASCADE,
to_field='slug'
)
name = models.CharField(max_length=200, blank=True) 
size = models.IntegerField(blank=True) 
term = models.CharField(max_length=100, blank=True) 
floor = models.IntegerField(blank=True)
window = models.BooleanField(blank=True)
price = models.DecimalField(max_digits=100, blank=True, decimal_places=2) 

class Meta: 
verbose_name_plural = 'spaces'

def get_absolute_url(self):
return reverse("office:space", kwags={'id': self.id})

def __str__(self):
return self.name

views.py
def space_edit_view(request, slug):
 office = Office.objects.get(slug=slug)
 form = UpdateSpaceForm(initial={'office': office.slug})
 if request.method == "POST":
 if form.is_valid(): 
 form.save()
 return redirect('office:office', slug=slug)

 context = {
 "form": form
 }

return render(request, "space_edit.html", context)

urls.py
from django.contrib import admin
from django.urls import path
from django.conf import settings # new
from django.conf.urls.static import static # new 
from .views import OfficeDetailView, OfficeEditView, space_edit_view

app_name = 'office'

urlpatterns=[
 path('offices/', OfficeDetailView.as_view(), name='office'),
 path('offices//edit', OfficeEditView.as_view(), name=
'office_edit'),
 path('offices//spaces/edit', space_edit_view, name=
'space_edit'),
]

if settings.DEBUG: # new
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

space_edit.html
{% include 'header.html' %}


Add new office space

{% csrf_token %}
{{ form.as_p }}




{% include 'footer.html' %}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3818c400-1d93-451d-90e7-85b5e4019637n%40googlegroups.com.


Re: Facing an issue in running a Django problem

2021-03-24 Thread Kasper Laudrup
On 24/03/2021 10.39, Saravanan R wrote:
> 
> I have tried different methods to get rid of this error 
> But I was unable to do so

It would be nice if you could tell us what "this error" is instead of
sending very hard to read pictures with your phone. I'm not much of a
Windows user, but I'm fairly certain the possibility to copy and paste
text exists.

Of course, this just hints that you're not very experienced with using
computers in the first place which is fine of course, but maybe it would
be a good idea to learn some basics before diving into programming.

> I even reinstalled KERAS and TENSORFLOW to match the dependencies

What makes you think that would change anything? Assuming you are
installing the exact same software version, what makes you think
reinstalling it would change anything? Are you leaving out some relevant
details?

> Please HELP me to solve this

Trying to imagine being someone wanting to help you and then think about
the information you have provided. You don't really make it easy for
anyone to help you even if they wanted to.

Exactly what doesn't work and where's the code that fails?

Take the time to write a proper question bearing in mind that the read
might be experienced with Django and Python but has no idea what you are
doing and you are trying to achieve. That will most likely help you get
some help.

Kind regards,

Kasper Laudrup

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e3b6f57e-cce2-4ed4-4997-2f64fc03c35b%40stacktrace.dk.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Facing an issue in running a Django problem

2021-03-24 Thread Prashanjeet Halder
I don't have much idea about tesorflow.

This is what i found on web :
https://www.codegrepper.com/code-examples/python/AttributeError%3A+module+%27tensorflow%27+has+no+attribute+%27get_default_session%27

See if that helps.
On Thursday, March 25, 2021 at 2:00:56 AM UTC+5:30 Kasper Laudrup wrote:

> On 24/03/2021 10.39, Saravanan R wrote:
> > 
> > I have tried different methods to get rid of this error 
> > But I was unable to do so
>
> It would be nice if you could tell us what "this error" is instead of
> sending very hard to read pictures with your phone. I'm not much of a
> Windows user, but I'm fairly certain the possibility to copy and paste
> text exists.
>
> Of course, this just hints that you're not very experienced with using
> computers in the first place which is fine of course, but maybe it would
> be a good idea to learn some basics before diving into programming.
>
> > I even reinstalled KERAS and TENSORFLOW to match the dependencies
>
> What makes you think that would change anything? Assuming you are
> installing the exact same software version, what makes you think
> reinstalling it would change anything? Are you leaving out some relevant
> details?
>
> > Please HELP me to solve this
>
> Trying to imagine being someone wanting to help you and then think about
> the information you have provided. You don't really make it easy for
> anyone to help you even if they wanted to.
>
> Exactly what doesn't work and where's the code that fails?
>
> Take the time to write a proper question bearing in mind that the read
> might be experienced with Django and Python but has no idea what you are
> doing and you are trying to achieve. That will most likely help you get
> some help.
>
> Kind regards,
>
> Kasper Laudrup
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aeeb8502-bf83-42b3-bb2d-bf11bfd3cc24n%40googlegroups.com.


Re: Data from form is not being saved in DB

2021-03-24 Thread Prashanjeet Halder
Hello,
Answer to your first question: You don't have to explicitly mention action 
attr. without that too it is possible to achieve the same operation.
you can check "practice04" in this Repository 
:  

For reverse match error:
specifying app_name under urls.py file helps to debug such errors.
On Wednesday, March 24, 2021 at 7:53:33 PM UTC+5:30 german@gmail.com 
wrote:

> Hi all!
>
> I'm newbie in Django, still trying to figure out how everything works and 
> this is my first back end framework, that I'm using. Currently building an 
> app like booking.com but for commercial property. 
>
> Among others I have models that represent office centers and office spaces 
> this is one-to-many relationship (1 office, many spaces). I've made a form 
> that adds spaces to a particular office, but this form doesn't seem to save 
> data.
>
> I'm stuck on the following:
> - Am I right that I need to point an action attribute in the form to 
> specify view which will save form data into DB? If yes, I'm struggling how 
> to do that, because I'm getting errors ReverseMatch
> - If this is not about action attr, what am I missing?
>
> Thank you in advance
> German
>
> ***
> models.py
> from django.db import models
> from django.urls import reverse
>
> class Office(models.Model):
> name = models.CharField(max_length=200)
> slug = models.SlugField(max_length=200, unique=True)
> image = models.ImageField(null=True, blank=True, upload_to='offices/')
> description = models.TextField(max_length=400, blank=True)
> address = models.CharField(max_length=200, blank=True)
> minprice = models.DecimalField(max_digits=6, blank=True, decimal_places=1)
> size = models.IntegerField(blank=True)
> worktime = models.CharField(max_length=200, blank=True)
>
> class Meta: 
> verbose_name_plural = 'offices'
>
> def get_absolute_url(self):
> return reverse("office:office", kwags={'id': self.id})
>
> def __str__(self):
> return self.name
>
> class Space(models.Model):
> office = models.ForeignKey(
> Office, 
> on_delete=models.CASCADE,
> to_field='slug'
> )
> name = models.CharField(max_length=200, blank=True) 
> size = models.IntegerField(blank=True) 
> term = models.CharField(max_length=100, blank=True) 
> floor = models.IntegerField(blank=True)
> window = models.BooleanField(blank=True)
> price = models.DecimalField(max_digits=100, blank=True, decimal_places=2) 
>
> class Meta: 
> verbose_name_plural = 'spaces'
>
> def get_absolute_url(self):
> return reverse("office:space", kwags={'id': self.id})
>
> def __str__(self):
> return self.name
>
> views.py
> def space_edit_view(request, slug):
>  office = Office.objects.get(slug=slug)
>  form = UpdateSpaceForm(initial={'office': office.slug})
>  if request.method == "POST":
>  if form.is_valid(): 
>  form.save()
>  return redirect('office:office', slug=slug)
>
>  context = {
>  "form": form
>  }
>
> return render(request, "space_edit.html", context)
>
> urls.py
> from django.contrib import admin
> from django.urls import path
> from django.conf import settings # new
> from django.conf.urls.static import static # new 
> from .views import OfficeDetailView, OfficeEditView, space_edit_view
>
> app_name = 'office'
>
> urlpatterns=[
>  path('offices/', OfficeDetailView.as_view(), name='office'
> ),
>  path('offices//edit', OfficeEditView.as_view(), name=
> 'office_edit'),
>  path('offices//spaces/edit', space_edit_view, name=
> 'space_edit'),
> ]
>
> if settings.DEBUG: # new
> urlpatterns += static(settings.MEDIA_URL, document_root=settings.
> MEDIA_ROOT)
>
> space_edit.html
> {% include 'header.html' %}
> 
> 
> Add new office space
>  method="post" enctype="multipart/form-data">
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> 
> 
> {% include 'footer.html' %}
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/26022f75-aa53-4e2e-b12a-a6d32ff77612n%40googlegroups.com.


Unable to run requests-html functions from Django views

2021-03-24 Thread Prashanjeet Halder
Hello all,
I'm trying to run a python script that uses requests-HTML library every 
time a view is triggered but getting an error.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fbf64146-5310-479d-a9fb-8a9b7dcfa2dfn%40googlegroups.com.


Re: Unable to run requests-html functions from Django views

2021-03-24 Thread Prashanjeet Halder
On Thursday, March 25, 2021 at 8:12:46 AM UTC+5:30 Prashanjeet Halder wrote:

> Hello all,
> I'm trying to run a python script that uses requests-HTML library every 
> time a view is triggered but getting an error.
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0022e3e3-a769-4c06-bb08-3c603aaf81f9n%40googlegroups.com.