Can someone help me??

2020-07-01 Thread Hella Nick
Can someone help me??


My project catalogue: 


My setttings:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]


My views:

from django.shortcuts import render,HttpResponse
from django.views.generic import View
from blog.tool.IPs import volume
from blog.models import Article

class index(View):
def get(self,request):
volume(request)
 
return render(request,'index.html')


Error:


Internal Server Error: /blog/index/
Traceback (most recent call last):
  File "D:\Python3\lib\site-packages\django\core\handlers\exception.py", 
line 34, in inner
response = get_response(request)
  File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line 
126, in _get_response
response = self.process_exception_by_middleware(e, request)
  File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line 
124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "D:\Python3\lib\site-packages\django\views\generic\base.py", line 
68, in view
return self.dispatch(request, *args, **kwargs)
  File "D:\Python3\lib\site-packages\django\views\generic\base.py", line 
88, in dispatch
return handler(request, *args, **kwargs)
  File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
return render(request,'index.html',locals())
  File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in 
render
content = loader.render_to_string(template_name, context, request, 
using=using)
  File "D:\Python3\lib\site-packages\django\template\loader.py", line 62, 
in render_to_string
return template.render(context, request)
  File "D:\Python3\lib\site-packages\django\template\backends\django.py", 
line 61, in render
return self.template.render(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 171, in 
render
return self._render(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 163, in 
_render
return self.nodelist.render(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 937, in 
render
bit = node.render_annotated(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 904, in 
render_annotated
return self.render(context)
  File "D:\Python3\lib\site-packages\django\template\defaulttags.py", line 
442, in render
url = reverse(view_name, args=args, kwargs=kwargs, 
current_app=current_app)
  File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in 
reverse
app_list = resolver.app_dict[ns]
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 477, 
in app_dict
self._populate()
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 430, 
in _populate
url_pattern._populate()
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 418, 
in _populate
self._callback_strs.add(url_pattern.lookup_str)
  File "D:\Python3\lib\site-packages\django\utils\functional.py", line 37, 
in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 360, 
in lookup_str
return callback.__module__ + "." + callback.__qualname__
TypeError: unsupported operand type(s) for +: 'ModelBase' and 'str'


   - 
   
   Can someone 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/840576c0-ef86-46ea-b35c-8a3708f7460bo%40googlegroups.com.


Re: Can someone help me??

2020-07-01 Thread oba stephen
The Error is straight forward, you are using an operand "+" for two two
data types that it can't be used on. This might be from your "volume"
function.

On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:

> Can someone help me??
>
>
> My project catalogue:
>
>
> My setttings:
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
> ,
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
>
> My views:
>
> from django.shortcuts import render,HttpResponse
> from django.views.generic import View
> from blog.tool.IPs import volume
> from blog.models import Article
>
> class index(View):
> def get(self,request):
> volume(request)
>
> return render(request,'index.html')
>
>
> Error:
>
>
> Internal Server Error: /blog/index/
> Traceback (most recent call last):
>   File "D:\Python3\lib\site-packages\django\core\handlers\exception.py",
> line 34, in inner
> response = get_response(request)
>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
> 126, in _get_response
> response = self.process_exception_by_middleware(e, request)
>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
> 124, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
> 68, in view
> return self.dispatch(request, *args, **kwargs)
>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
> 88, in dispatch
> return handler(request, *args, **kwargs)
>   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
> return render(request,'index.html',locals())
>   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
> render
> content = loader.render_to_string(template_name, context, request,
> using=using)
>   File "D:\Python3\lib\site-packages\django\template\loader.py", line 62,
> in render_to_string
> return template.render(context, request)
>   File "D:\Python3\lib\site-packages\django\template\backends\django.py",
> line 61, in render
> return self.template.render(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line 171,
> in render
> return self._render(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line 163,
> in _render
> return self.nodelist.render(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line 937,
> in render
> bit = node.render_annotated(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line 904,
> in render_annotated
> return self.render(context)
>   File "D:\Python3\lib\site-packages\django\template\defaulttags.py", line
> 442, in render
> url = reverse(view_name, args=args, kwargs=kwargs,
> current_app=current_app)
>   File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in
> reverse
> app_list = resolver.app_dict[ns]
>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 477,
> in app_dict
> self._populate()
>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 430,
> in _populate
> url_pattern._populate()
>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 418,
> in _populate
> self._callback_strs.add(url_pattern.lookup_str)
>   File "D:\Python3\lib\site-packages\django\utils\functional.py", line 37,
> in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 360,
> in lookup_str
> return callback.__module__ + "." + callback.__qualname__
> TypeError: unsupported operand type(s) for +: 'ModelBase' and 'str'
>
>
>-
>
>Can someone 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/840576c0-ef86-46ea-b35c-8a3708f7460bo%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 vis

Re: Can someone help me??

2020-07-01 Thread Sencer Hamarat
File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
return render(request,'index.html',locals())

According to this line in that error seems to have occurred while rendering.
There is at least one "+" operation in "index.html" or "local()" method
call.
You have to check data types where the "+" operator used.
And also according to the error itself, the one of that value is not a
string.
I think the "ModelBase" model has no '__str__'.

Saygılarımla,
Sencer HAMARAT



On Wed, Jul 1, 2020 at 12:04 PM oba stephen  wrote:

> The Error is straight forward, you are using an operand "+" for two two
> data types that it can't be used on. This might be from your "volume"
> function.
>
> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:
>
>> Can someone help me??
>>
>>
>> My project catalogue:
>>
>>
>> My setttings:
>>
>> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>> ,
>> 'APP_DIRS': True,
>> 'OPTIONS': {
>> 'context_processors': [
>> 'django.template.context_processors.debug',
>> 'django.template.context_processors.request',
>> 'django.contrib.auth.context_processors.auth',
>> 'django.contrib.messages.context_processors.messages',
>> ],
>> },
>> },
>> ]
>>
>>
>> My views:
>>
>> from django.shortcuts import render,HttpResponse
>> from django.views.generic import View
>> from blog.tool.IPs import volume
>> from blog.models import Article
>>
>> class index(View):
>> def get(self,request):
>> volume(request)
>>
>> return render(request,'index.html')
>>
>>
>> Error:
>>
>>
>> Internal Server Error: /blog/index/
>> Traceback (most recent call last):
>>   File "D:\Python3\lib\site-packages\django\core\handlers\exception.py",
>> line 34, in inner
>> response = get_response(request)
>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
>> 126, in _get_response
>> response = self.process_exception_by_middleware(e, request)
>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
>> 124, in _get_response
>> response = wrapped_callback(request, *callback_args,
>> **callback_kwargs)
>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
>> 68, in view
>> return self.dispatch(request, *args, **kwargs)
>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
>> 88, in dispatch
>> return handler(request, *args, **kwargs)
>>   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
>> get
>> return render(request,'index.html',locals())
>>   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
>> render
>> content = loader.render_to_string(template_name, context, request,
>> using=using)
>>   File "D:\Python3\lib\site-packages\django\template\loader.py", line 62,
>> in render_to_string
>> return template.render(context, request)
>>   File "D:\Python3\lib\site-packages\django\template\backends\django.py",
>> line 61, in render
>> return self.template.render(context)
>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 171,
>> in render
>> return self._render(context)
>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 163,
>> in _render
>> return self.nodelist.render(context)
>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 937,
>> in render
>> bit = node.render_annotated(context)
>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 904,
>> in render_annotated
>> return self.render(context)
>>   File "D:\Python3\lib\site-packages\django\template\defaulttags.py",
>> line 442, in render
>> url = reverse(view_name, args=args, kwargs=kwargs,
>> current_app=current_app)
>>   File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in
>> reverse
>> app_list = resolver.app_dict[ns]
>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 477,
>> in app_dict
>> self._populate()
>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 430,
>> in _populate
>> url_pattern._populate()
>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 418,
>> in _populate
>> self._callback_strs.add(url_pattern.lookup_str)
>>   File "D:\Python3\lib\site-packages\django\utils\functional.py", line
>> 37, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 360,
>> in lookup_str
>> return callback.__module__ + "." + callback.__qualname__
>> TypeError: unsupported operand type(s) for +: 'ModelBase' and 'str'
>>
>>
>>-
>>
>>Can someone help me??
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsub

Materializecss issue with CKeditor dialog

2020-07-01 Thread Sherif Adigun
If using materializecss for the application and image upload widget in the 
ckeditor, materializecss affects the dialog inputs making it impossible to 
use radio buttons and checkboxes. Do you have a suggestions on how to solve 
this?
I'm thinking of not loading the materialize css for the dialog box but i 
don't know how to make that work because i need to load that css file for 
the base page.

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/afd31026-4904-4ddc-8059-527a299664f0o%40googlegroups.com.


Re: How to display a line graph in Django?

2020-07-01 Thread Yamen Gamal Eldin
There's plotting library in Django.
But if I were u, I would send the data needs plotting to the template, and
plot it using a JavaScript library like chart js for small plots or d3 J's
for more professional ones.

Le mer. 1 juil. 2020 à 06:44, ratnadeep ray  a écrit :

> Hi all,
>
> I have wrote a python program to display the line graph as follows:
>
> import matplotlib.pyplot as plt
>
> x = [1,2,3]
> y = [2,4,1]
>
>
> plt.plot(x, y)
>
>
> plt.xlabel('x - axis')
> plt.ylabel('y - axis')
>
>
> plt.title('My first graph!')
>
> plt.show()
>
>
> Now I need to display the same via Django. So I think I need to write the
> above code in the view and then redirect the same to the html template
> file. Am I right?
>
> In that case, how to send the request objects related to the line chart to
> the template?
>
> Normally, we send in the following format:
>
> def view1(request)
>
>
>  return render(request, 'display_report.html', { 'var1': "abc", ...
>  ... })
>
> So if we are trying to display the line graph generated by the above code,
> how to do so ?
>
> Please share your inputs.
>
> 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/827e0d0c-6bbb-4511-af73-9fa379df699do%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/CAOwHV6_cc-UbjQkSv6fRG_MbQxOWCL1goM%2BjuyBkD0vbghn2ig%40mail.gmail.com.


Re: How to display a line graph in Django?

2020-07-01 Thread shedd tutt
Use chartjs

On Wed, 1 Jul 2020, 07:45 ratnadeep ray  wrote:

> Hi all,
>
> I have wrote a python program to display the line graph as follows:
>
> import matplotlib.pyplot as plt
>
> x = [1,2,3]
> y = [2,4,1]
>
>
> plt.plot(x, y)
>
>
> plt.xlabel('x - axis')
> plt.ylabel('y - axis')
>
>
> plt.title('My first graph!')
>
> plt.show()
>
>
> Now I need to display the same via Django. So I think I need to write the
> above code in the view and then redirect the same to the html template
> file. Am I right?
>
> In that case, how to send the request objects related to the line chart to
> the template?
>
> Normally, we send in the following format:
>
> def view1(request)
>
>
>  return render(request, 'display_report.html', { 'var1': "abc", ...
>  ... })
>
> So if we are trying to display the line graph generated by the above code,
> how to do so ?
>
> Please share your inputs.
>
> 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/827e0d0c-6bbb-4511-af73-9fa379df699do%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/CALY6ddd%3DN_WdOY%2B4xSUx13BjVeAdEo3ywQR5F3xUZk%2B6O4Q2jA%40mail.gmail.com.


Re: Need suggestions-Reg

2020-07-01 Thread shedd tutt
Zoom

On Wed, 1 Jul 2020, 05:38 Sai Pavan Kumar  wrote:

> Hi ,
> I need to integrate the video conferencing in my Django
> application.which is the best open source video conferencing tool available
> .please suggest me.
>
> Thanks and Regards
> Pavan T
>
> --
> 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/CAFJPboZZJmF5Z-nnT6MLui%2BP8AzvMB3i3itzXFNZEUPyiSe%3D_g%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/CALY6ddcG0U%2BM86oKaU-wP7XSOsE8vVAPAMXY4bmggTeGjRKk1Q%40mail.gmail.com.


Admin documentation incorrect hyperlinks

2020-07-01 Thread Martyn Pearson
I have an issue with Django, so wanted to raise it here before going to the 
extent of raising a bug.

For a simple scenario, I have a site "Survey", an app "Report" and models 
"Question" and "Answer". Note that the case is important; I've capitalised 
the first letter of each.

Admin documentation is turned on, and if I go to the documentation models 
page (e.g. http://localhost:8000/admin/doc/models/) I can see a link to the 
Question and Answer pages and this link takes me to the model pages 
correctly, for example the Question page at 
http://localhost:8000/admin/doc/models/Report.question/

However, if I try to follow any of the links on that page to other models - 
either those generated automatically or those I add through the use of the 
text :model:`Report.Question` they fail. It appears that the links have 
been generated using a lower case representation of the app, i.e. 
http://localhost:8000/admin/doc/models/report.question/ 
 rather than the 
correct case.

Does this indicate I have missed something or is this likely to be a bug 
which I need to raise on the bug tracker?

For transparency, I will add that I have posted this on Stack Overflow too 
- 
https://stackoverflow.com/questions/62656784/django-admin-documentation-with-mixed-case-project-name
 - 
but should either approach yield a solution I'll update the other for 
others reference.

Many 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/e2adcf1f-1952-4fad-ac80-2502da0560cco%40googlegroups.com.


Re: Need suggestions-Reg

2020-07-01 Thread o1bigtenor
On Wed, Jul 1, 2020 at 7:56 AM shedd tutt  wrote:
>
> Zoom
>
> On Wed, 1 Jul 2020, 05:38 Sai Pavan Kumar  wrote:
>>
>> Hi ,
>> I need to integrate the video conferencing in my Django 
>> application.which is the best open source video conferencing tool available 
>> .please suggest me.


You bet - - - Zoom is a great choice if you like feeding the internet
information
slurp system. If you don't there are other systems out there. Have heard
suggestions of OpenMeeting and Jitsi but have only participated with
OpenMeeting and it seemed to work well most of the time.

Regards

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


Re: Need suggestions-Reg

2020-07-01 Thread Karan Sahu
Hi Pavan,
I can suggest if you want then I can do the same also.

Best,
Karan

On Wednesday, July 1, 2020, Sai Pavan Kumar  wrote:

> Hi ,
> I need to integrate the video conferencing in my Django
> application.which is the best open source video conferencing tool available
> .please suggest me.
>
> Thanks and Regards
> Pavan T
>
> --
> 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/CAFJPboZZJmF5Z-nnT6MLui%2BP8AzvMB3i3itzXFNZEUPyiSe%3D_
> g%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/CAOWRdhDUqihAau3dMwCcPThc7z4wvuoT9F1Q0qnveyJY_X30ew%40mail.gmail.com.


Re: How to add domain from GoDaddy to Heroku

2020-07-01 Thread Micah Beckman
I finally got it sorted out. Buried deep in the blogs and FAQs they say that 
GoDaddy is going to be a problem, yet I have seen tutorials that use GoDaddy. 
Anyway, I got a domain on DNSimple and everything worked out immediately. They 
have a one-click connection to Heroku. Thank you for responding. 

> On Jun 30, 2020, at 3:18 AM, Akinfolarin Stephen 
>  wrote:
> 
> at what point where you stuck can you share may be i can be of help
> 
> On Tue, Jun 30, 2020 at 12:16 PM John McClain  > wrote:
> I was able to do so Micah
> 
> it took almost a day to propagate though. How long has it been since you did 
> the redirects
> 
> 
> On Mon, 29 Jun 2020 at 22:39, Micah Beckman  > wrote:
> I'm having the exact same issue. The helpline folks weren't able to sort it 
> out either. 
> 
> On Monday, June 22, 2020 at 4:44:51 PM UTC-4, sunday honesty wrote:
> Has anyone here added a custom domain from GoDaddy to Heroku?
> I have not been able to configure my DNS correctly after following tons of 
> articles online... GoDaddy don't seem to have good customer care for my 
> country and no live support available?
> 
> The issue is, I have bought the domain and added it to Heroku and generated 
> the target for DNS.
> On Heroku, I entered manage DNS to add the target url generated from Heroku 
> and got a bad request (400) error if I set CNAME to www and value to the 
> target from Heroku. I have followed the exact step I got from online and non 
> is working for me.
> Anyone who can help me will be appreciated.
> 
> 
> 
> -- 
> 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/7b7f8c5c-8da5-4c77-a271-3d51190b5d7ao%40googlegroups.com
>  
> .
> 
> 
> -- 
> John McClain
> 
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@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/CAN-hv_rnzKkmaixiQb%3D_SZxvGH4FFOy07hgs6-ijTgbfb%3DTK%2Bg%40mail.gmail.com
>  
> .
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Django users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/django-users/IhNWLJ1HJP0/unsubscribe 
> .
> To unsubscribe from this group and all its topics, 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/CAFujGLxbV5kL47xJsZ2CBuTRiSF%3DEB33hy4MPj-4JUqvmyz9ww%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/2A66F402-E5F4-4028-BA1A-F013FC2BBB3E%40gmail.com.


Primary keys using sequences

2020-07-01 Thread Stats Student
Hi, I am using a Postgres database and have been populating the primary key 
from a sequence. Is there any way to define this behavior through Django's 
ORM? 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/51536187-5f73-4ddf-ae60-602673569495o%40googlegroups.com.


Re: Primary keys using sequences

2020-07-01 Thread Clive Bruton



On 2 Jul 2020, at 00:06, Stats Student wrote:

Hi, I am using a Postgres database and have been populating the  
primary key from a sequence. Is there any way to define this  
behavior through Django's ORM? Thanks


I think you are basically asking how to create a custom key. This was  
discussed a few days ago, look for the thread "Custom Primary Key".



-- Clive

--
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/762F7935-2DA1-4334-B706-48675E8E5D2A%40indx.co.uk.


Re: Can someone help me??

2020-07-01 Thread Hella Nick
Dear  Sencer:


>   index




   -

 There is no problem with writing this wayI don't understand why.


Thank You

Sencer Hamarat  于2020年7月1日周三 下午5:13写道:

> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
> return render(request,'index.html',locals())
>
> According to this line in that error seems to have occurred while
> rendering.
> There is at least one "+" operation in "index.html" or "local()" method
> call.
> You have to check data types where the "+" operator used.
> And also according to the error itself, the one of that value is not a
> string.
> I think the "ModelBase" model has no '__str__'.
>
> Saygılarımla,
> Sencer HAMARAT
>
>
>
> On Wed, Jul 1, 2020 at 12:04 PM oba stephen  wrote:
>
>> The Error is straight forward, you are using an operand "+" for two two
>> data types that it can't be used on. This might be from your "volume"
>> function.
>>
>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:
>>
>>> Can someone help me??
>>>
>>>
>>> My project catalogue:
>>>
>>>
>>> My setttings:
>>>
>>> TEMPLATES = [
>>> {
>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>>> ,
>>> 'APP_DIRS': True,
>>> 'OPTIONS': {
>>> 'context_processors': [
>>> 'django.template.context_processors.debug',
>>> 'django.template.context_processors.request',
>>> 'django.contrib.auth.context_processors.auth',
>>> 'django.contrib.messages.context_processors.messages',
>>> ],
>>> },
>>> },
>>> ]
>>>
>>>
>>> My views:
>>>
>>> from django.shortcuts import render,HttpResponse
>>> from django.views.generic import View
>>> from blog.tool.IPs import volume
>>> from blog.models import Article
>>>
>>> class index(View):
>>> def get(self,request):
>>> volume(request)
>>>
>>> return render(request,'index.html')
>>>
>>>
>>> Error:
>>>
>>>
>>> Internal Server Error: /blog/index/
>>> Traceback (most recent call last):
>>>   File "D:\Python3\lib\site-packages\django\core\handlers\exception.py",
>>> line 34, in inner
>>> response = get_response(request)
>>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
>>> 126, in _get_response
>>> response = self.process_exception_by_middleware(e, request)
>>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
>>> 124, in _get_response
>>> response = wrapped_callback(request, *callback_args,
>>> **callback_kwargs)
>>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
>>> 68, in view
>>> return self.dispatch(request, *args, **kwargs)
>>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
>>> 88, in dispatch
>>> return handler(request, *args, **kwargs)
>>>   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
>>> get
>>> return render(request,'index.html',locals())
>>>   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
>>> render
>>> content = loader.render_to_string(template_name, context, request,
>>> using=using)
>>>   File "D:\Python3\lib\site-packages\django\template\loader.py", line
>>> 62, in render_to_string
>>> return template.render(context, request)
>>>   File
>>> "D:\Python3\lib\site-packages\django\template\backends\django.py", line 61,
>>> in render
>>> return self.template.render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 171,
>>> in render
>>> return self._render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 163,
>>> in _render
>>> return self.nodelist.render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 937,
>>> in render
>>> bit = node.render_annotated(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 904,
>>> in render_annotated
>>> return self.render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\defaulttags.py",
>>> line 442, in render
>>> url = reverse(view_name, args=args, kwargs=kwargs,
>>> current_app=current_app)
>>>   File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in
>>> reverse
>>> app_list = resolver.app_dict[ns]
>>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
>>> 477, in app_dict
>>> self._populate()
>>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
>>> 430, in _populate
>>> url_pattern._populate()
>>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
>>> 418, in _populate
>>> self._callback_strs.add(url_pattern.lookup_str)
>>>   File "D:\Python3\lib\site-packages\django\utils\functional.py", line
>>> 37, in __get__
>>> res = instance.__dict__[self.name] = self.func(instance)
>>>   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
>>> 360, in lookup_

Re: Can someone help me??

2020-07-01 Thread Hella Nick
Dear  Mir  oba stephen:

 I deleted  "volume" function,But The result is the same.

Hella Nick  于2020年7月2日周四 上午10:51写道:

> Dear  Sencer:
>
>
>>   index
>
>
>
>
>-
>
>  There is no problem with writing this wayI don't understand why.
>
>
> Thank You
>
> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>
>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
>> return render(request,'index.html',locals())
>>
>> According to this line in that error seems to have occurred while
>> rendering.
>> There is at least one "+" operation in "index.html" or "local()" method
>> call.
>> You have to check data types where the "+" operator used.
>> And also according to the error itself, the one of that value is not a
>> string.
>> I think the "ModelBase" model has no '__str__'.
>>
>> Saygılarımla,
>> Sencer HAMARAT
>>
>>
>>
>> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
>> wrote:
>>
>>> The Error is straight forward, you are using an operand "+" for two two
>>> data types that it can't be used on. This might be from your "volume"
>>> function.
>>>
>>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:
>>>
 Can someone help me??


 My project catalogue:


 My setttings:

 TEMPLATES = [
 {
 'BACKEND': 'django.template.backends.django.DjangoTemplates',
 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
 ,
 'APP_DIRS': True,
 'OPTIONS': {
 'context_processors': [
 'django.template.context_processors.debug',
 'django.template.context_processors.request',
 'django.contrib.auth.context_processors.auth',
 'django.contrib.messages.context_processors.messages',
 ],
 },
 },
 ]


 My views:

 from django.shortcuts import render,HttpResponse
 from django.views.generic import View
 from blog.tool.IPs import volume
 from blog.models import Article

 class index(View):
 def get(self,request):
 volume(request)

 return render(request,'index.html')


 Error:


 Internal Server Error: /blog/index/
 Traceback (most recent call last):
   File
 "D:\Python3\lib\site-packages\django\core\handlers\exception.py", line 34,
 in inner
 response = get_response(request)
   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
 line 126, in _get_response
 response = self.process_exception_by_middleware(e, request)
   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
 line 124, in _get_response
 response = wrapped_callback(request, *callback_args,
 **callback_kwargs)
   File "D:\Python3\lib\site-packages\django\views\generic\base.py",
 line 68, in view
 return self.dispatch(request, *args, **kwargs)
   File "D:\Python3\lib\site-packages\django\views\generic\base.py",
 line 88, in dispatch
 return handler(request, *args, **kwargs)
   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
 get
 return render(request,'index.html',locals())
   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
 render
 content = loader.render_to_string(template_name, context, request,
 using=using)
   File "D:\Python3\lib\site-packages\django\template\loader.py", line
 62, in render_to_string
 return template.render(context, request)
   File
 "D:\Python3\lib\site-packages\django\template\backends\django.py", line 61,
 in render
 return self.template.render(context)
   File "D:\Python3\lib\site-packages\django\template\base.py", line
 171, in render
 return self._render(context)
   File "D:\Python3\lib\site-packages\django\template\base.py", line
 163, in _render
 return self.nodelist.render(context)
   File "D:\Python3\lib\site-packages\django\template\base.py", line
 937, in render
 bit = node.render_annotated(context)
   File "D:\Python3\lib\site-packages\django\template\base.py", line
 904, in render_annotated
 return self.render(context)
   File "D:\Python3\lib\site-packages\django\template\defaulttags.py",
 line 442, in render
 url = reverse(view_name, args=args, kwargs=kwargs,
 current_app=current_app)
   File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in
 reverse
 app_list = resolver.app_dict[ns]
   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
 477, in app_dict
 self._populate()
   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
 430, in _populate
 url_pattern._populate()
   File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line
 418, in _populate
 self._callback_s

Re: Can someone help me??

2020-07-01 Thread oba stephen
Can you share your models.py?

Like Sencer said you have to check data types where the "+" operator is
used.

On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:

> Dear  Mir  oba stephen:
>
>  I deleted  "volume" function,But The result is the same.
>
> Hella Nick  于2020年7月2日周四 上午10:51写道:
>
>> Dear  Sencer:
>>
>>
>>>   index
>>
>>
>>
>>
>>-
>>
>>  There is no problem with writing this wayI don't understand why.
>>
>>
>> Thank You
>>
>> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>>
>>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
>>> return render(request,'index.html',locals())
>>>
>>> According to this line in that error seems to have occurred while
>>> rendering.
>>> There is at least one "+" operation in "index.html" or "local()" method
>>> call.
>>> You have to check data types where the "+" operator used.
>>> And also according to the error itself, the one of that value is not a
>>> string.
>>> I think the "ModelBase" model has no '__str__'.
>>>
>>> Saygılarımla,
>>> Sencer HAMARAT
>>>
>>>
>>>
>>> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
>>> wrote:
>>>
 The Error is straight forward, you are using an operand "+" for two two
 data types that it can't be used on. This might be from your "volume"
 function.

 On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:

> Can someone help me??
>
>
> My project catalogue:
>
>
> My setttings:
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
> ,
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
>
> My views:
>
> from django.shortcuts import render,HttpResponse
> from django.views.generic import View
> from blog.tool.IPs import volume
> from blog.models import Article
>
> class index(View):
> def get(self,request):
> volume(request)
>
> return render(request,'index.html')
>
>
> Error:
>
>
> Internal Server Error: /blog/index/
> Traceback (most recent call last):
>   File
> "D:\Python3\lib\site-packages\django\core\handlers\exception.py", line 34,
> in inner
> response = get_response(request)
>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
> line 126, in _get_response
> response = self.process_exception_by_middleware(e, request)
>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
> line 124, in _get_response
> response = wrapped_callback(request, *callback_args,
> **callback_kwargs)
>   File "D:\Python3\lib\site-packages\django\views\generic\base.py",
> line 68, in view
> return self.dispatch(request, *args, **kwargs)
>   File "D:\Python3\lib\site-packages\django\views\generic\base.py",
> line 88, in dispatch
> return handler(request, *args, **kwargs)
>   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25,
> in get
> return render(request,'index.html',locals())
>   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
> render
> content = loader.render_to_string(template_name, context, request,
> using=using)
>   File "D:\Python3\lib\site-packages\django\template\loader.py", line
> 62, in render_to_string
> return template.render(context, request)
>   File
> "D:\Python3\lib\site-packages\django\template\backends\django.py", line 
> 61,
> in render
> return self.template.render(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line
> 171, in render
> return self._render(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line
> 163, in _render
> return self.nodelist.render(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line
> 937, in render
> bit = node.render_annotated(context)
>   File "D:\Python3\lib\site-packages\django\template\base.py", line
> 904, in render_annotated
> return self.render(context)
>   File "D:\Python3\lib\site-packages\django\template\defaulttags.py",
> line 442, in render
> url = reverse(view_name, args=args, kwargs=kwargs,
> current_app=current_app)
>   File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in
> reverse
> app_list = resolver.app_dict[ns]
>   File "D:\Python3\lib\site-packages\django\urls\reso

Re: Can someone help me??

2020-07-01 Thread Hella Nick
>
> class Article(models.Model):
> # time = datetime.datetime.now()
> IMG_LINK = '/static/images/summary.jpg'
> id = models.AutoField(primary_key=True,verbose_name='自增主键')
> title = models.CharField(verbose_name='文章标题',max_length=100)
> intro = models.CharField(max_length=300,verbose_name='文章摘要')
> content = MDTextField(verbose_name='文章正文')
> img_link = models.CharField('图片地址', default=IMG_LINK, max_length=255)
> addtime = models.DateTimeField(verbose_name='发布时间',auto_now =True)
> updatetime = models.DateTimeField(verbose_name='修改时间', auto_now=True)
> number = models.IntegerField(verbose_name='阅读量',default=0)
> loves = models.IntegerField(verbose_name='点赞',default=0)
> keywords = models.CharField(max_length=120,verbose_name='文章关键词',)
> sort = 
> models.ForeignKey('Sort',to_field='id',on_delete=models.CASCADE,verbose_name='分类外键')
> member = 
> models.OneToOneField(User,on_delete=models.CASCADE,related_name='profile',verbose_name='用户一对多外键')
>
> class Mate:
> verbose_name = '文章'
> verbose_name_plural = verbose_name
> ordering = ['-updatetime']
>
> def __str__(self):
> return self.title[:20]
>
> # def get_absolute_url(self):
> # return reversed('blog:article',kwargs={'sulg':self.id})
> # return reverse('blog:detail', kwargs={'pk':self.id})
>
> def body_to_markdown(self):
> return markdown.markdown(self.content.replace("\r\n", '  
> \n'),extensions=[
> 'markdown.extensions.extra',
> 'markdown.extensions.codehilite',
> 'markdown.extensions.toc',
> ],safe_mode=True,enable_attributes = False)
>
> def update_view(self):
> self.number += 1
> self.save(update_fields=['number'])
>
> def get_pre(self):
> return Article.objects.filter(id__lt=self.id).order_by('-id').first()
>
> def get_next(self):
> return Article.objects.filter(id__gt=self.id).order_by('id').first()
>
>
oba stephen  于2020年7月2日周四 下午2:28写道:

> Can you share your models.py?
>
> Like Sencer said you have to check data types where the "+" operator is
> used.
>
> On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:
>
>> Dear  Mir  oba stephen:
>>
>>  I deleted  "volume" function,But The result is the same.
>>
>> Hella Nick  于2020年7月2日周四 上午10:51写道:
>>
>>> Dear  Sencer:
>>>
>>>
   index
>>>
>>>
>>>
>>>
>>>-
>>>
>>>  There is no problem with writing this wayI don't understand
>>>why.
>>>
>>>
>>> Thank You
>>>
>>> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>>>
 File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
 get
 return render(request,'index.html',locals())

 According to this line in that error seems to have occurred while
 rendering.
 There is at least one "+" operation in "index.html" or "local()" method
 call.
 You have to check data types where the "+" operator used.
 And also according to the error itself, the one of that value is not a
 string.
 I think the "ModelBase" model has no '__str__'.

 Saygılarımla,
 Sencer HAMARAT



 On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
 wrote:

> The Error is straight forward, you are using an operand "+" for two
> two data types that it can't be used on. This might be from your "volume"
> function.
>
> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick 
> wrote:
>
>> Can someone help me??
>>
>>
>> My project catalogue:
>>
>>
>> My setttings:
>>
>> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>> ,
>> 'APP_DIRS': True,
>> 'OPTIONS': {
>> 'context_processors': [
>> 'django.template.context_processors.debug',
>> 'django.template.context_processors.request',
>> 'django.contrib.auth.context_processors.auth',
>> 'django.contrib.messages.context_processors.messages',
>> ],
>> },
>> },
>> ]
>>
>>
>> My views:
>>
>> from django.shortcuts import render,HttpResponse
>> from django.views.generic import View
>> from blog.tool.IPs import volume
>> from blog.models import Article
>>
>> class index(View):
>> def get(self,request):
>> volume(request)
>>
>> return render(request,'index.html')
>>
>>
>> Error:
>>
>>
>> Internal Server Error: /blog/index/
>> Traceback (most recent call last):
>>   File
>> "D:\Python3\lib\site-packages\django\core\handlers\exception.py", line 
>> 34,
>> in inner
>> response = get_response(request)
>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
>> line 126, in _get_re

Re: Can someone help me??

2020-07-01 Thread Mohammed Alnajdi
The error seems to be somewhere in the Urls

I think it might be issue with
"{% url 'blog:index/' %}"

try to remove the slash
"{% url 'blog:index' %}"

you might need to do the same with other urls


On Thu, Jul 2, 2020 at 9:31 AM Hella Nick  wrote:

> class Article(models.Model):
>> # time = datetime.datetime.now()
>> IMG_LINK = '/static/images/summary.jpg'
>> id = models.AutoField(primary_key=True,verbose_name='自增主键')
>> title = models.CharField(verbose_name='文章标题',max_length=100)
>> intro = models.CharField(max_length=300,verbose_name='文章摘要')
>> content = MDTextField(verbose_name='文章正文')
>> img_link = models.CharField('图片地址', default=IMG_LINK, max_length=255)
>> addtime = models.DateTimeField(verbose_name='发布时间',auto_now =True)
>> updatetime = models.DateTimeField(verbose_name='修改时间', auto_now=True)
>> number = models.IntegerField(verbose_name='阅读量',default=0)
>> loves = models.IntegerField(verbose_name='点赞',default=0)
>> keywords = models.CharField(max_length=120,verbose_name='文章关键词',)
>> sort = 
>> models.ForeignKey('Sort',to_field='id',on_delete=models.CASCADE,verbose_name='分类外键')
>> member = 
>> models.OneToOneField(User,on_delete=models.CASCADE,related_name='profile',verbose_name='用户一对多外键')
>>
>> class Mate:
>> verbose_name = '文章'
>> verbose_name_plural = verbose_name
>> ordering = ['-updatetime']
>>
>> def __str__(self):
>> return self.title[:20]
>>
>> # def get_absolute_url(self):
>> # return reversed('blog:article',kwargs={'sulg':self.id})
>> # return reverse('blog:detail', kwargs={'pk':self.id})
>>
>> def body_to_markdown(self):
>> return markdown.markdown(self.content.replace("\r\n", '  
>> \n'),extensions=[
>> 'markdown.extensions.extra',
>> 'markdown.extensions.codehilite',
>> 'markdown.extensions.toc',
>> ],safe_mode=True,enable_attributes = False)
>>
>> def update_view(self):
>> self.number += 1
>> self.save(update_fields=['number'])
>>
>> def get_pre(self):
>> return Article.objects.filter(id__lt=self.id).order_by('-id').first()
>>
>> def get_next(self):
>> return Article.objects.filter(id__gt=self.id).order_by('id').first()
>>
>>
> oba stephen  于2020年7月2日周四 下午2:28写道:
>
>> Can you share your models.py?
>>
>> Like Sencer said you have to check data types where the "+" operator is
>> used.
>>
>> On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:
>>
>>> Dear  Mir  oba stephen:
>>>
>>>  I deleted  "volume" function,But The result is the same.
>>>
>>> Hella Nick  于2020年7月2日周四 上午10:51写道:
>>>
 Dear  Sencer:


>   index




-

  There is no problem with writing this wayI don't understand
why.


 Thank You

 Sencer Hamarat  于2020年7月1日周三 下午5:13写道:

> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
> get
> return render(request,'index.html',locals())
>
> According to this line in that error seems to have occurred while
> rendering.
> There is at least one "+" operation in "index.html" or "local()"
> method call.
> You have to check data types where the "+" operator used.
> And also according to the error itself, the one of that value is not a
> string.
> I think the "ModelBase" model has no '__str__'.
>
> Saygılarımla,
> Sencer HAMARAT
>
>
>
> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
> wrote:
>
>> The Error is straight forward, you are using an operand "+" for two
>> two data types that it can't be used on. This might be from your "volume"
>> function.
>>
>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick 
>> wrote:
>>
>>> Can someone help me??
>>>
>>>
>>> My project catalogue:
>>>
>>>
>>> My setttings:
>>>
>>> TEMPLATES = [
>>> {
>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>>> ,
>>> 'APP_DIRS': True,
>>> 'OPTIONS': {
>>> 'context_processors': [
>>> 'django.template.context_processors.debug',
>>> 'django.template.context_processors.request',
>>> 'django.contrib.auth.context_processors.auth',
>>> 'django.contrib.messages.context_processors.messages',
>>> ],
>>> },
>>> },
>>> ]
>>>
>>>
>>> My views:
>>>
>>> from django.shortcuts import render,HttpResponse
>>> from django.views.generic import View
>>> from blog.tool.IPs import volume
>>> from blog.models import Article
>>>
>>> class index(View):
>>> def get(self,request):
>>> volume(request)
>>>
>>> return render(request,'index.ht

Re: Can someone help me??

2020-07-01 Thread oba stephen
I don't see anything wrong with the Models.py file, I think you should try
removing those slash "/" just as Mohammed said.

On Thu, Jul 2, 2020 at 7:40 AM Mohammed Alnajdi  wrote:

> The error seems to be somewhere in the Urls
>
> I think it might be issue with
> "{% url 'blog:index/' %}"
>
> try to remove the slash
> "{% url 'blog:index' %}"
>
> you might need to do the same with other urls
>
>
> On Thu, Jul 2, 2020 at 9:31 AM Hella Nick  wrote:
>
>> class Article(models.Model):
>>> # time = datetime.datetime.now()
>>> IMG_LINK = '/static/images/summary.jpg'
>>> id = models.AutoField(primary_key=True,verbose_name='自增主键')
>>> title = models.CharField(verbose_name='文章标题',max_length=100)
>>> intro = models.CharField(max_length=300,verbose_name='文章摘要')
>>> content = MDTextField(verbose_name='文章正文')
>>> img_link = models.CharField('图片地址', default=IMG_LINK, max_length=255)
>>> addtime = models.DateTimeField(verbose_name='发布时间',auto_now =True)
>>> updatetime = models.DateTimeField(verbose_name='修改时间', auto_now=True)
>>> number = models.IntegerField(verbose_name='阅读量',default=0)
>>> loves = models.IntegerField(verbose_name='点赞',default=0)
>>> keywords = models.CharField(max_length=120,verbose_name='文章关键词',)
>>> sort = 
>>> models.ForeignKey('Sort',to_field='id',on_delete=models.CASCADE,verbose_name='分类外键')
>>> member = 
>>> models.OneToOneField(User,on_delete=models.CASCADE,related_name='profile',verbose_name='用户一对多外键')
>>>
>>> class Mate:
>>> verbose_name = '文章'
>>> verbose_name_plural = verbose_name
>>> ordering = ['-updatetime']
>>>
>>> def __str__(self):
>>> return self.title[:20]
>>>
>>> # def get_absolute_url(self):
>>> # return reversed('blog:article',kwargs={'sulg':self.id})
>>> # return reverse('blog:detail', kwargs={'pk':self.id})
>>>
>>> def body_to_markdown(self):
>>> return markdown.markdown(self.content.replace("\r\n", '  
>>> \n'),extensions=[
>>> 'markdown.extensions.extra',
>>> 'markdown.extensions.codehilite',
>>> 'markdown.extensions.toc',
>>> ],safe_mode=True,enable_attributes = False)
>>>
>>> def update_view(self):
>>> self.number += 1
>>> self.save(update_fields=['number'])
>>>
>>> def get_pre(self):
>>> return 
>>> Article.objects.filter(id__lt=self.id).order_by('-id').first()
>>>
>>> def get_next(self):
>>> return Article.objects.filter(id__gt=self.id).order_by('id').first()
>>>
>>>
>> oba stephen  于2020年7月2日周四 下午2:28写道:
>>
>>> Can you share your models.py?
>>>
>>> Like Sencer said you have to check data types where the "+" operator is
>>> used.
>>>
>>> On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:
>>>
 Dear  Mir  oba stephen:

  I deleted  "volume" function,But The result is the same.

 Hella Nick  于2020年7月2日周四 上午10:51写道:

> Dear  Sencer:
>
>
>>   index
>
>
>
>
>-
>
>  There is no problem with writing this wayI don't understand
>why.
>
>
> Thank You
>
> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>
>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
>> get
>> return render(request,'index.html',locals())
>>
>> According to this line in that error seems to have occurred while
>> rendering.
>> There is at least one "+" operation in "index.html" or "local()"
>> method call.
>> You have to check data types where the "+" operator used.
>> And also according to the error itself, the one of that value is not
>> a string.
>> I think the "ModelBase" model has no '__str__'.
>>
>> Saygılarımla,
>> Sencer HAMARAT
>>
>>
>>
>> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
>> wrote:
>>
>>> The Error is straight forward, you are using an operand "+" for two
>>> two data types that it can't be used on. This might be from your 
>>> "volume"
>>> function.
>>>
>>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick 
>>> wrote:
>>>
 Can someone help me??


 My project catalogue:


 My setttings:

 TEMPLATES = [
 {
 'BACKEND': 'django.template.backends.django.DjangoTemplates',
 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
 ,
 'APP_DIRS': True,
 'OPTIONS': {
 'context_processors': [
 'django.template.context_processors.debug',
 'django.template.context_processors.request',
 'django.contrib.auth.context_processors.auth',
 'django.contrib.messages.context_processors.messages',
 ],
 },
 },
 ]


 My view

Re: Can someone help me??

2020-07-01 Thread Hella Nick
Thank you Oba Stephen and Mohammed Alnajdi.
I think this is a real BUG.
I'm ready to rebuild the project.
Thank you again.

oba stephen  于2020年7月2日周四 下午2:48写道:

> I don't see anything wrong with the Models.py file, I think you should try
> removing those slash "/" just as Mohammed said.
>
> On Thu, Jul 2, 2020 at 7:40 AM Mohammed Alnajdi 
> wrote:
>
>> The error seems to be somewhere in the Urls
>>
>> I think it might be issue with
>> "{% url 'blog:index/' %}"
>>
>> try to remove the slash
>> "{% url 'blog:index' %}"
>>
>> you might need to do the same with other urls
>>
>>
>> On Thu, Jul 2, 2020 at 9:31 AM Hella Nick  wrote:
>>
>>> class Article(models.Model):
 # time = datetime.datetime.now()
 IMG_LINK = '/static/images/summary.jpg'
 id = models.AutoField(primary_key=True,verbose_name='自增主键')
 title = models.CharField(verbose_name='文章标题',max_length=100)
 intro = models.CharField(max_length=300,verbose_name='文章摘要')
 content = MDTextField(verbose_name='文章正文')
 img_link = models.CharField('图片地址', default=IMG_LINK, max_length=255)
 addtime = models.DateTimeField(verbose_name='发布时间',auto_now =True)
 updatetime = models.DateTimeField(verbose_name='修改时间', auto_now=True)
 number = models.IntegerField(verbose_name='阅读量',default=0)
 loves = models.IntegerField(verbose_name='点赞',default=0)
 keywords = models.CharField(max_length=120,verbose_name='文章关键词',)
 sort = 
 models.ForeignKey('Sort',to_field='id',on_delete=models.CASCADE,verbose_name='分类外键')
 member = 
 models.OneToOneField(User,on_delete=models.CASCADE,related_name='profile',verbose_name='用户一对多外键')

 class Mate:
 verbose_name = '文章'
 verbose_name_plural = verbose_name
 ordering = ['-updatetime']

 def __str__(self):
 return self.title[:20]

 # def get_absolute_url(self):
 # return reversed('blog:article',kwargs={'sulg':self.id})
 # return reverse('blog:detail', kwargs={'pk':self.id})

 def body_to_markdown(self):
 return markdown.markdown(self.content.replace("\r\n", '  
 \n'),extensions=[
 'markdown.extensions.extra',
 'markdown.extensions.codehilite',
 'markdown.extensions.toc',
 ],safe_mode=True,enable_attributes = False)

 def update_view(self):
 self.number += 1
 self.save(update_fields=['number'])

 def get_pre(self):
 return 
 Article.objects.filter(id__lt=self.id).order_by('-id').first()

 def get_next(self):
 return 
 Article.objects.filter(id__gt=self.id).order_by('id').first()


>>> oba stephen  于2020年7月2日周四 下午2:28写道:
>>>
 Can you share your models.py?

 Like Sencer said you have to check data types where the "+" operator is
 used.

 On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:

> Dear  Mir  oba stephen:
>
>  I deleted  "volume" function,But The result is the same.
>
> Hella Nick  于2020年7月2日周四 上午10:51写道:
>
>> Dear  Sencer:
>>
>>
>>>   index
>>
>>
>>
>>
>>-
>>
>>  There is no problem with writing this wayI don't understand
>>why.
>>
>>
>> Thank You
>>
>> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>>
>>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25,
>>> in get
>>> return render(request,'index.html',locals())
>>>
>>> According to this line in that error seems to have occurred while
>>> rendering.
>>> There is at least one "+" operation in "index.html" or "local()"
>>> method call.
>>> You have to check data types where the "+" operator used.
>>> And also according to the error itself, the one of that value is not
>>> a string.
>>> I think the "ModelBase" model has no '__str__'.
>>>
>>> Saygılarımla,
>>> Sencer HAMARAT
>>>
>>>
>>>
>>> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
>>> wrote:
>>>
 The Error is straight forward, you are using an operand "+" for two
 two data types that it can't be used on. This might be from your 
 "volume"
 function.

 On Wed, Jul 1, 2020 at 9:30 AM Hella Nick 
 wrote:

> Can someone help me??
>
>
> My project catalogue:
>
>
> My setttings:
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
> ,
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
>