Re: JSON file

2020-05-24 Thread Derek
I am not sure about the field names part, but you could probably create 
that manually very easily.

For the data section, you need a list of lists, which you can get from code 
like:

import json
data_ready_for_json = 
list(mail_item_count_deliveries_perDate.objects.values_list('countDeliveries','Dates'))
json_string = json.dumps(data_ready_for_json)

(P.S. you may want to consider giving your classes more Python-like names 
e.g. class MailDelivery )


On Friday, 22 May 2020 19:48:36 UTC+2, HJ wrote:
>
> hello django users hope you are doing well 
>
> I want to do a highchart using a json file , and that's the problem I am 
> facing , I want to create a json file in my views.py based on my columns 
> below "countDeliveries"and "Dates"
>
> class mail_item_count_deliveries_perDate(models.Model):
>countDeliveries = models.IntegerField(default=0)
>Dates = models.DateTimeField()
>
>
> myJSON file should be something like that:
>  
>
> [
> [
> Dates,
> countDeliveries
> ],
> [
> 116769600,
> 5
> ],
>
>
>  
> - can you guys help me out 
>

-- 
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/19830969-d813-4e51-9016-b9b820945b92%40googlegroups.com.


403 serving static files

2020-05-24 Thread みやうち`
Hi,

I'm trying to serve static files using nginx, but nginx gives following 
error.
- [error] 8202#8202: *10 open() "/home/user/myproject/media/xxx.jpg" failed 
(13: Permission denied)

I've tried giving all users permission to this directory and it didn't 
change.
What is the cause?

I'm using mod_wsgi 4.7.1 and apache 2.4.
my apache setting is here.

WSGIPythonHome /home/user/mypythonenv
WSGIScriptAlias / /home/user/myproject/myproject/wsgi.py
WSGIPythonPath 
/home/user/myproject/myproject:/home/user/mypythonenv/lib/python3.6/site-packages
WSGIApplicationGroup %{GLOBAL}


 
  Require all granted
 


Alias /static/ /home/user/myproject/collected_static/

 Options Indexes FollowSymLinks
 AllowOverride None
 Require all granted


Alias /media/ /home/user/myproject/media/

 Options Indexes FollowSymLinks
 AllowOverride None
 Require all granted


-- 
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/23624e5b-2701-45fb-9672-c179cb979403%40googlegroups.com.


Re: Database audit fields in Django

2020-05-24 Thread Derek
There are many things available "by default" in other frameworks; but 
Django has chose to keep the core focused on doing key things well (I won't 
say "simple").  For everything else, the plugin/app approach can be used to 
support your project's specific needs.

So "auditing" is actually a complex issue and no one person or organisation 
will define this the same way.  However, there are some good apps out there 
that might support at least some of what you need; for example:

https://github.com/treyhunner/django-simple-history

https://github.com/jjkester/django-auditlog

I'd look at those before considering writing any code yourself.
 

On Friday, 22 May 2020 23:40:02 UTC+2, Sujata Aghor wrote:
>
> I am looking to create a database audit fields such as 'created by' , ' 
> modified by', 'created on time', ' modified on time' and Archive table 
> where i can see the changes over the time about perticular row.
>
> this was possible in web2py automatically. Does anyone knows any such 
> thing exist in Django?
> Any idea will be a gr8 help.
> Thanks
>

-- 
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/54620e24-43d5-4609-9198-92db29ee53a4%40googlegroups.com.


aws s3 file upload without imagefiled and filefield

2020-05-24 Thread Parampal Singh
please help

-- 
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/dc4da995-1ac2-424f-932d-b0b639af050a%40googlegroups.com.


Re: What is considered copyright when it comes to building a website?

2020-05-24 Thread Mike Dewhirst
If you listen to Tim Berners-Lee, the design of web browsers should 
always enable revealing the source of the page for the prime purpose of 
educating others to develop websites. It is designed in.


If you are concerned, drop them a line and congratulate them on a good 
layout and thank them for helping you with your design.


IANAL

On 25/05/2020 9:21 am, Adam Scerra wrote:
I understand that many CSS style sheets are passed around and shared 
frequently across the web. My question is when does leveraging someone 
else's web page code become illegal?


Example here is:
Finding a website that I would like to emulate.
Copying their HTML files and CSS files.
Editing the HTML file to replace their content with my content
Leaving the CSS files exactly as they are since I like the style and 
format of the page.


Is this copyright and is it illegal?

If it is at what point does the problem arise, and how would you best 
recommend I go about this if I am a beginner?


Thank you all for your time!
--
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/bc099c5c-637b-4c17-9e18-031d0039eb99%40googlegroups.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/1b114e42-9fb3-982e-a1ee-4cf102aa967a%40dewhirst.com.au.


RE: Error while trying to send email for password reset

2020-05-24 Thread Vishesh Mangla
\u...    represents a Unicode character and you are using an ascii-decoder to decode it.Consider using encoding=”utf-8”. Sent from Mail for Windows 10 From: sunday honestySent: 24 May 2020 21:09To: Django usersSubject: Error while trying to send email for password reset I got the following error while trying to send email with send grid smtp UnicodeEncodeError: 'ascii' codec can't encode character '\u2020' in position 168: ordinal not in range(128) -- 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/e3baf159-4247-413a-89cf-7c1993aee2b1%40googlegroups.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/5ecb3208.1c69fb81.b1a28.755f%40mx.google.com.


Re: Template Variations title not showing

2020-05-24 Thread Ahmed Khairy
here is the link 
https://groups.google.com/forum/#!topic/django-users/5SckOumQLQM

On Sunday, May 24, 2020 at 10:38:18 PM UTC-4, Ahmed Khairy wrote:
>
> Helloo,
>
> Check my views in this question link, it might be useful 
>
> On Saturday, May 23, 2020 at 1:35:32 AM UTC-4, oldtimer wrote:
>>
>> I cannot get variations or I tried model forms for options as well and 
>> cannot get either to add to the cart. I can get both to display as options 
>> on the product page, but that is as far as I've made it. Need some help on 
>> how to get the views.py to get the options and post to cart.
>>
>

-- 
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/00bb7b45-22c2-4375-b48a-a7c7ef5ad7ac%40googlegroups.com.


Re: Template Variations title not showing

2020-05-24 Thread Ahmed Khairy
Helloo,

Check my views in this question link, it might be useful 

On Saturday, May 23, 2020 at 1:35:32 AM UTC-4, oldtimer wrote:
>
> I cannot get variations or I tried model forms for options as well and 
> cannot get either to add to the cart. I can get both to display as options 
> on the product page, but that is as far as I've made it. Need some help on 
> how to get the views.py to get the options and post to cart.
>

-- 
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/681ca6d2-7f33-4bf1-8e0d-d998db3f7fc3%40googlegroups.com.


Changing in the Quantity of variants reflecting in the wrong item in Order Summary

2020-05-24 Thread Ahmed Khairy
Helloo,

I have a problem with the variations and the quantity related to it in the 
order summary page. 

It was working perfectly and all of a sudden (this is an example to 
simplify):

when I add to the cart 2 items:

- Item X with a size small 
- Item X with a size medium

When I change the quantity of item X size medium, this change is reflecting 
in item X size small which was chosen first. 

In the order summary, there are a plus and minus in the template to change 
the quantity. 

I have identified the problem but I can't figure out why it is occurring

Here is the template:
 Order Summary

{% for order_item in object.items.all %}

{{ forloop.counter }}
{{ order_item.item.title }}
{{ order_item.item.price }}


{{ order_item.quantity }}




{% if order_item.variation.all %}
{% for variation in order_item.variation.all %}
{{ variation.title|capfirst }}
{% endfor %}
{% endif %}
 
```
Here is the views.py

class OrderSummaryView(LoginRequiredMixin, View):
def get(self, *args, **kwargs):

try:
order = Order.objects.get(user=self.request.user, ordered=False)
context = {
'object': order
}
return render(self.request, 'order_summary.html', context)
except ObjectDoesNotExist:
messages.warning(self.request, "You do not have an active 
order")
return redirect("/")


@login_required
def add_to_cart(request, slug):
item = get_object_or_404(Item, slug=slug)

order_item_qs = OrderItem.objects.filter(
item=item,
user=request.user,
ordered=False
)

item_var = []  # item variation
if request.method == 'POST':
for items in request.POST:
key = items
val = request.POST[key]
try:
v = Variation.objects.get(
item=item,
category__iexact=key,
title__iexact=val
)
item_var.append(v)
except:
pass

if len(item_var) > 0:
for items in item_var:
order_item_qs = order_item_qs.filter(
variation__exact=items,
)

if order_item_qs.exists():
order_item = order_item_qs.first()
order_item.quantity += 1
order_item.save()
else:
order_item = OrderItem.objects.create(
item=item,
user=request.user,
ordered=False
)
order_item.variation.add(*item_var)
order_item.save()

order_qs = Order.objects.filter(user=request.user, ordered=False)
if order_qs.exists():
order = order_qs[0]
# check if the order item is in the order
if not order.items.filter(item__id=order_item.id).exists():
order.items.add(order_item)
messages.info(request, "This item quantity was updated.")
return redirect("core:order-summary")
else:
ordered_date = timezone.now()
order = Order.objects.create(
user=request.user, ordered_date=ordered_date)
order.items.add(order_item)
messages.info(request, "This item was added to cart.")
return redirect("core:order-summary")


@login_required
def remove_from_cart(request, slug):
item = get_object_or_404(Item, slug=slug)
order_qs = Order.objects.filter(
user=request.user,
ordered=False
)
if order_qs.exists():
order = order_qs[0]
# check if the order item is in the order
if order.items.filter(item__slug=item.slug).exists():
order_item = OrderItem.objects.filter(
item=item,
user=request.user,
ordered=False
)[0]
order.items.remove(order_item)
order_item.delete()
messages.info(request, "This item was removed from your cart")
return redirect("core:order-summary")

else:
messages.info(request, "This item was not in your cart")
return redirect("core:product", slug=slug)
else:
messages.info(request, "You don't have an active order")
return redirect("core:product", slug=slug)


@login_required
def remove_single_item_from_cart(request, slug):
item = get_object_or_404(Item, slug=slug)
order_qs = Order.objects.filter(
user=request.user,
ordered=False
)
if order_qs.exists():
order = order_qs[0]
# check if the order item is in the order
if order.items.filter(item__slug=item.slug).exists():
order_item = OrderItem.objects.filter(
item=item,
 

Issue with CRUD Operation

2020-05-24 Thread Ifeanyi Chielo
Hello,
I performed a CRUD operation and every thing is working well except two 
things
1. my insert form does not clear the text boxes after saving a record
2. my delete operation renders an error page after deleting a record with a 
message ''DoesNotExist at /delete/3/" or "AttributeError at /delete/6/" 
example of the error messages are  shown below. i also attached view.py, 
model.py and template file

DoesNotExist at /delete/3/

Soapprod matching query does not exist.

*Request Method:*

POST

*Request URL:*

http://localhost:8000/delete/3/

*Django Version:*

2.1.5

*Exception Type:*

DoesNotExist

*Exception Value:*

Soapprod matching query does not exist.

*Exception Location:*

C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\models\query.py
 
in get, line 399

*Python Executable:*

C:\Users\IFEANYI CHIELO\AppData\Local\Programs\Python\Python37\python.exe

*Python Version:*

3.7.2

*Python Path:*

['C:\\Users\\IFEANYI CHIELO\\divinecrown',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',

 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

*Server time:*

Mon, 25 May 2020 00:03:25 +


or


AttributeError at /delete/6/

'str' object has no attribute 'get'

*Request Method:*

POST

*Request URL:*

http://localhost:8000/delete/6/

*Django Version:*

2.1.5

*Exception Type:*

AttributeError

*Exception Value:*

'str' object has no attribute 'get'

*Exception Location:*

C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\middleware\clickjacking.py
 
in process_response, line 26

*Python Executable:*

C:\Users\IFEANYI CHIELO\AppData\Local\Programs\Python\Python37\python.exe

*Python Version:*

3.7.2

*Python Path:*

['C:\\Users\\IFEANYI CHIELO\\divinecrown',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',

 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

*Server time:*

Mon, 25 May 2020 00:09:23 +

-- 
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/b43b280d-ab19-4620-8544-133c897396f0%40googlegroups.com.

{% extends "base.html" %}
{% load crispy_forms_tags %}


{% block content %}

{% csrf_token %}


{{form.date|as_crispy_field}}


{{form.Serial_White_Guava|as_crispy_field}} 


{{form.Serial_White_Premium|as_crispy_field}}


{{form.Soft_Flower_Body_Wash|as_crispy_field}} 


{{form.Soft_Flower_Fresh|as_crispy_field}}


{{form.Soft_Flower_Orange_Lightening|as_crispy_field}} 


{{form.Soft_Flower_Carot_Lightening|as_crispy_field}} 


{{form.Soft_Flower_Papaya_Extract|as_crispy_field}}


{{form.Soft_Flower_Extra_Lightening|as_crispy_field}} 


{{form.Serial_White_Papaya_4in1|as_crispy_field}}





Submit



 Back to list





{% endblock content %}# from django.shortcuts import render
# from .models import Postrec
# from .forms import ProductForm

# # Create your views here.

# # Create your views here.
# from django.views.generic import TemplateView

# class HomePageView (TemplateView):
# template_name = 'home.html'
# class AboutPageView (TemplateView):
# template_name = 'about.html'
# #from django.shortcuts import render
# class CreatepostPageView (TemplateView):
# template_name = 'createpost.html'

from django.http import HttpResponseRedirect
# from django.shortcuts import redirect
from django.shortcuts import render
from .models import Soapprod
from .forms import StaffrecForm, SoapprodForm
from django.views.generic import TemplateView

# def HomePageView (request, *args, **kwargs):
#  return render(request,"home.html", {})
def Basep_view (request,*args, **kwargs):
 return render(request,"basep.html", {})
def Namev_view (request,*args, **kwargs):
if request.method == 'POST':
form 

What is considered copyright when it comes to building a website?

2020-05-24 Thread Adam Scerra
I understand that many CSS style sheets are passed around and shared 
frequently across the web. My question is when does leveraging someone 
else's web page code become illegal?

Example here is:
Finding a website that I would like to emulate.
Copying their HTML files and CSS files.
Editing the HTML file to replace their content with my content
Leaving the CSS files exactly as they are since I like the style and format 
of the page.

Is this copyright and is it illegal?

If it is at what point does the problem arise, and how would you best 
recommend I go about this if I am a beginner?

Thank you all for your time!

-- 
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/bc099c5c-637b-4c17-9e18-031d0039eb99%40googlegroups.com.


Re: function model which generate a code for model field

2020-05-24 Thread Kasper Laudrup

Hi Anselme,

On 24/05/2020 17.48, Anselme SERI wrote:


I try  to to write a correct function for my model which  generate a str 
+ incremental number according last id model.




Your code is obviously wrong for quite a few reasons, but I at least 
simply cannot understand what you are trying to achieve.


What should the "correct function" do?

The id field of a model is already incremental. Do you simply want to 
append that to a string and what do you want to do with that string?


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/65ffe493-1190-619a-f904-fbe35b60e3e3%40stacktrace.dk.


aws s3 file upload without imagefiled and filefield

2020-05-24 Thread Parampal Singh
*first sorry for weak English*

*in code *

*im get image from url *
*save like that*
#load image in skimage libray
img = io.imread(poster)
#to edit image opencv convert colors to rgb
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
#now load logo
logo = cv2.imread("static/assets/logo_o.jpg")
h_img, w_img, _ = img.shape
h_logo, w_logo, _ = logo.shape
center_y = int(h_img / 2)
center_x = int(w_img / 2)
top_y = center_y - int(h_logo / 2)
left_x = center_x - int(w_logo / 2)
bottom_y = top_y + h_logo
right_x = left_x + w_logo
roi = img[top_y: bottom_y, left_x: right_x]
# Add the Logo to the Roi
result = cv2.addWeighted(roi, 1, logo, 0.3, 0)
# Replace the ROI on the image
img[top_y: bottom_y, left_x: right_x] = result
# Get filename and save the image
cv2.imwrite(f"media/movie_poster/{save_file_name}_preview.jpg", img)



*but now i try to use aws s3 how i can upload image on aws please help*

-- 
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/CANYMdQ%2Bt6HwMwGdC4NzO25adepaPdmoD_OujWx10ZYn6SR48Lg%40mail.gmail.com.


function model which generate a code for model field

2020-05-24 Thread Anselme SERI

>
> from django.db import models
>
>
> def codeid():
> lastid = MyModel.objects.last(id)
> autocode = ''
> if lastid == 0:
> autocode = 'BAC1'
> elif lastid != 0:
> if len(lastid) <= 8:
> lastid += 1
> autocode = 'D/BAC/' + lastid
> elif 9 < len(lastid) <= 98:
> lastid += 1
> autocode = 'D/BAC/000' + lastid
> elif 99 < len(lastid) <= 998:
> lastid += 1
> autocode = 'D/BAC/00' + lastid
> return autocode
>
>
> class MyModel(models.Model):
> libelle = models.CharField('Libellé', max_length=100)
> code = models.CharField(max_length=30, unique=True, auto_created=codeid())
>
> def __str__(self):
> return self.code
>
>
Hello,

I try  to to write a correct function for my model which  generate a str + 
incremental number according last id model.

Pleaz help me.
 

-- 
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/50ca58a3-d81d-4883-9693-268538c52a88%40googlegroups.com.


Error while trying to send email for password reset

2020-05-24 Thread sunday honesty
I got the following error while trying to send email with send grid smtp

UnicodeEncodeError: 'ascii' codec can't encode character '\u2020' in 
position 168: ordinal not in range(128)

-- 
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/e3baf159-4247-413a-89cf-7c1993aee2b1%40googlegroups.com.


Re: JSON data

2020-05-24 Thread Saurabh Adhikary
data =  [{"exped": "MA", "destin": "AL", "count": 2}, {"exped": "MA", 
"destin": "BS", "count": 1}] 
mylist = []
for a in data :
mylist.append([a['exped'],a['destin'],a['count']])



On Sunday, 24 May 2020 17:16:46 UTC+5:30, HJ wrote:
>
> hello guys hope you are doing well 
>
> I am trying to make a highchart but I found a problem in the view function 
> so my chart doesn't show becuase of that 
>
> view function 
>
> def jsonDepend(request):
>  dataset = mail_item_countries_depend.objects.all().values('exped',
> 'destin','count')
>  data = list(dataset)
>
>   return JsonResponse(data, safe=False)
>
>
> my views function show something like this : [{"exped": "MA", "destin": 
> "AL", "count": 2}, {"exped": "MA", "destin": "BS", "count": 1}]  
>
> how can I store it like that : [["MA", "AL",  2], ["MA", "BS", 1]] 
>

-- 
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/0a644423-e96c-46d5-9f3e-c9dd3195f189%40googlegroups.com.


Re: 403 Forbidden

2020-05-24 Thread Kasper Laudrup

Hi Sunday,

On 24/05/2020 15.17, sunday honesty wrote:
Yes, I have both custom password_reset_email.html and 
password_reset_subject.txt at /registration/...


But are you sure the correct name is 403.html?



That makes sense. You don't have custom *error* pages, but custom 
registration pages. That's something different.


I've only done customization for 404 and 500 errors, but that worked 
fine when adding them in my root templates dir as 404.html and 500.html 
so I can only assume it would work the same for custom 403 error pages, 
but I'm not sure.


I tested that the actual error pages were used by setting Debug to False 
temporarily in development and then added some handlers for rendering 
them specifically at /404 and /500 in development so I could use static 
files etc.


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/8f26e322-2958-53af-afe1-d9e34843fa84%40stacktrace.dk.


Re: 403 Forbidden

2020-05-24 Thread sunday honesty
Yes, I have both custom password_reset_email.html and
password_reset_subject.txt at /registration/...

But are you sure the correct name is 403.html?

On Sun, May 24, 2020, 2:11 PM Kasper Laudrup  wrote:

> Hi Sunday,
>
> On 24/05/2020 15.04, sunday honesty wrote:
> > What I mean is that it's still outputting the default " 403 forbidden"
> > and not using any custom template.
> > If it's because default=True in my settings, why did my other custom
> > template at "templates/registration/... displayed?
> >
>
> OK. That doesn't sound related to the "Debug=True" setting, although it
> does sound weird if your other custom error pages are being shown with
> Debug settings enabled?
>
> Maybe someone else has an idea?
>
> 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/00b9a322-de31-ab7e-8eb2-f239233f2f42%40stacktrace.dk
> .
>

-- 
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/CALcuGNsg%3DZjegt%3Dgm04YerhfS_kB-Gdt7sYFOorFgBtYXPA7cg%40mail.gmail.com.


Re: 403 Forbidden

2020-05-24 Thread Kasper Laudrup

Hi Sunday,

On 24/05/2020 15.04, sunday honesty wrote:
What I mean is that it's still outputting the default " 403 forbidden" 
and not using any custom template.
If it's because default=True in my settings, why did my other custom 
template at "templates/registration/... displayed?




OK. That doesn't sound related to the "Debug=True" setting, although it 
does sound weird if your other custom error pages are being shown with 
Debug settings enabled?


Maybe someone else has an idea?

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/00b9a322-de31-ab7e-8eb2-f239233f2f42%40stacktrace.dk.


Re: 403 Forbidden

2020-05-24 Thread sunday honesty
What I mean is that it's still outputting the default " 403 forbidden" and
not using any custom template.
If it's because default=True in my settings, why did my other custom
template at "templates/registration/... displayed?

On Sun, May 24, 2020, 1:59 PM Kasper Laudrup  wrote:

> Hi Sunday,
>
> On 24/05/2020 13.46, sunday honesty wrote:
> > Trust you're doing great guys!
> > Please can someone help with the template name where 403 forbidden
> message that always displays when you raise PermissionDenied.
> > I want to customize the message that should display...
> > I have tried
> > 403.html in my registration folder inside my templates folder but it's
> not working.
> >
>
> It's hard to guess what you mean by "not working", but be aware that
> custom error pages are not used when Debug is set to True in your
> settings. Maybe that's why it's "not working".
>
> 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/d096c046-a5ec-ebd8-2cd6-d2d9803cc8df%40stacktrace.dk
> .
>

-- 
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/CALcuGNt_ZjzkKVmeQdhg768yXQeDxLGZtLqpBQY327gFkS_5dA%40mail.gmail.com.


Re: 403 Forbidden

2020-05-24 Thread Kasper Laudrup

Hi Sunday,

On 24/05/2020 13.46, sunday honesty wrote:

Trust you're doing great guys!
Please can someone help with the template name where 403 forbidden message that 
always displays when you raise PermissionDenied.
I want to customize the message that should display...
I have tried
403.html in my registration folder inside my templates folder but it's not 
working.



It's hard to guess what you mean by "not working", but be aware that 
custom error pages are not used when Debug is set to True in your 
settings. Maybe that's why it's "not working".


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/d096c046-a5ec-ebd8-2cd6-d2d9803cc8df%40stacktrace.dk.


Re: " AttributeError at /register/ " facing problem in implementing user registration

2020-05-24 Thread Kasper Laudrup

Hi Madhav,

On 24/05/2020 13.08, Madhav Nandan wrote:

I'm creating a register page.

see the screenshot below., I'm following lectures and doing as 
instructed but still stuck.




I don't see how the screenshots are related to the issue you are having. 
Please explain.


here is the source code of my course: 
https://github.com/codingforentrepreneurs/eCommerce/tree/master/src/ecommerce




Great. How is that relevant?


Please help me get run the code.



I *am* trying to help you. I asked you some questions related to the 
problem you were facing. You could start by answering those.


Feel free to ask any further questions related to that if something's 
not clear.


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/4d98054b-983b-4db7-bdfd-344e80cc07e1%40stacktrace.dk.


JSON data

2020-05-24 Thread HJ
hello guys hope you are doing well 

I am trying to make a highchart but I found a problem in the view function 
so my chart doesn't show becuase of that 

view function 

def jsonDepend(request):
 dataset = mail_item_countries_depend.objects.all().values('exped','destin',
'count')
 data = list(dataset)

  return JsonResponse(data, safe=False)


my views function show something like this : [{"exped": "MA", "destin": 
"AL", "count": 2}, {"exped": "MA", "destin": "BS", "count": 1}]  

how can I store it like that : [["MA", "AL",  2], ["MA", "BS", 1]] 

-- 
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/724f6ea8-87fe-42f2-bfac-d44c70cd30b9%40googlegroups.com.


403 Forbidden

2020-05-24 Thread sunday honesty
Trust you're doing great guys!
Please can someone help with the template name where 403 forbidden message that 
always displays when you raise PermissionDenied.
I want to customize the message that should display...
I have tried
403.html in my registration folder inside my templates folder but it's not 
working.

-- 
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/565fb257-f6ce-4412-9a1f-20e8d439b4f2%40googlegroups.com.


Re: " AttributeError at /register/ " facing problem in implementing user registration

2020-05-24 Thread Kasper Laudrup

Hi Madhav,

On 24/05/2020 04.54, Madhav Nandan wrote:

Hi,
I need help here. I did the required changes in forms.py as well as in 
view.py but my user registration still not working.




Once again, try to make sense from the error messages. They are actually 
pointing to your problem quite clearly.


In this case, what is your "User" object in your forms.py file?

It is hard to tell since you've only provided some screenshots, but this 
line:


User = get_user_model()

in your views.py file looks very suspicious.

Why are you creating a global User variable?

Did you do the same in forms.py for some reason and why?

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/1e2d5ba7-09f1-0b70-69bf-f136598b7989%40stacktrace.dk.