Re: Django cms and templates

2019-09-19 Thread MEGA NATHAN
Hi.

you check app name  127.0.0.8/app name




*Regards*
Meganathan G



On Thu, Sep 19, 2019 at 4:30 AM Perceval Maturure 
wrote:

> Dear all
>
> I have a django project done with Django 2.1 and successfully made an
> apphook to the cms page bt the problem is that the template file does not
> display model data unless if I remove the syntax { %extends base.html %} at
> the top of the template html file
> What could be causing this?
> Please help
>
> Sent from my iPhone
>
> --
> 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/4CE4415B-DDC4-4074-8F8C-630D98641EE5%40gmail.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/CAEvDBLc%2B-yyHC4cxsGH8wrk_v-6q-cpgWwK7x0q-6ajkfO2cHQ%40mail.gmail.com.


Re: ModuleNotFoundError: No module named :

2019-09-24 Thread MEGA NATHAN
Hi.
 again i change and run but same problem coming 



*Regards*
Meganathan G



On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
wrote:

> Error in admin.py. So same here in admin.py.
>
> Before starting a django project, try to understand the architecture of it
> and the working flow of it.
> Otherwise, you can't go long away.
> Best Wishes,
>
> On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
> wrote:
>
>> In your views.py:
>> from .models import users
>>
>> That's it.
>>
>> On Tue, Sep 24, 2019 at 10:13 AM Deep Sukhwani 
>> wrote:
>>
>>> Are you supposed to be using a virtualenv and you don't have that
>>> activated?
>>>
>>> Can you run *pip freeze | grep -i django* and share the output?
>>>
>>> --
>>> Regards
>>> Deep L Sukhwani
>>>
>>>
>>> On Tue, 24 Sep 2019 at 09:40, MEGA NATHAN 
>>> wrote:
>>>
>>>> Hi.
>>>>
>>>>
>>>> i 'm meganathan from india i was doing django trining ,
>>>>
>>>> And i have one dout .mo module name found models
>>>>
>>>> *ModuleNotFoundError: No module named 'django.models'*
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *Regards*
>>>> *Meganathan,*
>>>>
>>>> --
>>>> 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/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEvDBLeWLN4%3DpQSBA8AkoLQF5ByWXvcScZJznL__6kQR20UAfg%40mail.gmail.com.


Re: ModuleNotFoundError: No module named :

2019-09-25 Thread MEGA NATHAN
hi.

populate script error in line 12




*Regards*
Meganathan G



On Wed, Sep 25, 2019 at 9:57 AM Abu Yusuf 
wrote:

> share your full project here.
>
> On Tue, Sep 24, 2019 at 10:43 PM MEGA NATHAN 
> wrote:
>
>>
>>
>> Hi.
>>  again i change and run but same problem coming 
>>
>>
>>
>> *Regards*
>> Meganathan G
>>
>>
>>
>> On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
>> wrote:
>>
>>> Error in admin.py. So same here in admin.py.
>>>
>>> Before starting a django project, try to understand the architecture of
>>> it and the working flow of it.
>>> Otherwise, you can't go long away.
>>> Best Wishes,
>>>
>>> On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
>>> wrote:
>>>
>>>> In your views.py:
>>>> from .models import users
>>>>
>>>> That's it.
>>>>
>>>> On Tue, Sep 24, 2019 at 10:13 AM Deep Sukhwani 
>>>> wrote:
>>>>
>>>>> Are you supposed to be using a virtualenv and you don't have that
>>>>> activated?
>>>>>
>>>>> Can you run *pip freeze | grep -i django* and share the output?
>>>>>
>>>>> --
>>>>> Regards
>>>>> Deep L Sukhwani
>>>>>
>>>>>
>>>>> On Tue, 24 Sep 2019 at 09:40, MEGA NATHAN 
>>>>> wrote:
>>>>>
>>>>>> Hi.
>>>>>>
>>>>>>
>>>>>> i 'm meganathan from india i was doing django trining ,
>>>>>>
>>>>>> And i have one dout .mo module name found models
>>>>>>
>>>>>> *ModuleNotFoundError: No module named 'django.models'*
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *Regards*
>>>>>> *Meganathan,*
>>>>>>
>>>>>> --
>>>>>> 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/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/django-users/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> 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/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAEvDBLeWLN4%3DpQSBA8AkoLQF5ByWXvcScZJznL__6kQR20UAfg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEvDBLeWLN4%3DpQSBA8AkoLQF5ByWXvcScZJznL__6kQR20UAfg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CACNsr2-GJBUAZs7hhe6JhTnXQOO7zdrivNygQp%3DR78%2Bdb9UP0w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACNsr2-GJBUAZs7hhe6JhTnXQOO7zdrivNygQp%3DR78%2Bdb9UP0w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEvDBLcCVNnQHS9Q8AMF%2B17Mn%3DYZLdbwgT9sQaXi%2BfHGK6UCtQ%40mail.gmail.com.


Re: cannot import path in urls

2019-10-02 Thread MEGA NATHAN
Hi.
In which  file i rewrite app/urls are main file url i write...





*Regards*
Meganathan G



On Thu, Oct 3, 2019 at 10:21 AM Suraj Thapa FC 
wrote:

> In urls.py
> Write
> from django.urls import path
>
> On Thu, 3 Oct, 2019, 10:02 AM MEGA NATHAN, 
> wrote:
>
>> Hi.
>>
>>
>> i'm meganathan beginer for django 
>>
>> urls cannot import for path . how to reslove 
>>
>> --
>> 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/a0c82af4-da14-49e4-a0af-eff26f47afbd%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/a0c82af4-da14-49e4-a0af-eff26f47afbd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAPjsHcEv9-av30MrCetr0FxAHHEpjHM_0jiava_PP6XdKQWLwg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPjsHcEv9-av30MrCetr0FxAHHEpjHM_0jiava_PP6XdKQWLwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEvDBLdYvK%2BQBYCfX_g3mchvJ91NT5xEXA8ZDjFqjru-SLPU3A%40mail.gmail.com.


database could't connect in python to atom

2019-10-22 Thread MEGA NATHAN
Hi.

AttributeError: module 'mysql.connector' has no attribute 'connect'





regards
Meganathan,

-- 
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/20f71ae7-75ed-4126-b786-6c675041d9f9%40googlegroups.com.


Re: simple Rest_framework cannot import name in api view

2019-11-12 Thread MEGA NATHAN
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py",
 
line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py",
 
line 577, in urlconf_module
return import_module(self.urlconf_name)
  File 
"C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
 
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 967, in _find_and_load_unlocked
  File "", line 677, in _load_unlocked
  File "", line 728, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\drf_api\urls.py", 
line 4, in 
from core.views import TestView
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py", 
line 8, in 
from core.serializers import PostSerializer
ImportError: cannot import name 'PostSerializer' from 'core.serializers' 
(C:\Users\Meghanathan\Desktop\java script\drf_api\core\serializers.py)



On Wednesday, November 13, 2019 at 7:48:00 AM UTC+5:30, MEGA NATHAN wrote:
>
> Hi.
>
> i was creating simple REST_framework this api view ,connot import name in 
> error. how to reslove this error 
>
>
>
> __.py", line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1006, in _gcd_import
>   File "", line 983, in _find_and_load
>   File "", line 967, in 
> _find_and_load_unlocked
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in 
> _call_with_frames_removed
>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\drf_api\urls.py", 
> line 4, in 
> from core.views import test_view
>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py", 
> line 6, in 
> from rest_framework.views import APIview
> ImportError: cannot import name 'APIview' from 'rest_framework.views' 
> (C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py)
>
>
> Regards
> Meganathan G
>

-- 
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/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com.


Re: simple Rest_framework cannot import name in api view

2019-11-12 Thread MEGA NATHAN
yeah bro





*Regards*
Meganathan G



On Wed, Nov 13, 2019 at 10:15 AM Suraj Thapa FC 
wrote:

> It should be like.. APIView  not like APIview
>
> On Wed, 13 Nov 2019, 9:33 am MEGA NATHAN, 
> wrote:
>
>> patterns = getattr(self.urlconf_module, "urlpatterns",
>> self.urlconf_module)
>>   File
>> "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py",
>> line 80, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File
>> "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py",
>> line 577, in urlconf_module
>> return import_module(self.urlconf_name)
>>   File
>> "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
>> line 127, in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 1006, in _gcd_import
>>   File "", line 983, in _find_and_load
>>   File "", line 967, in
>> _find_and_load_unlocked
>>   File "", line 677, in _load_unlocked
>>   File "", line 728, in exec_module
>>   File "", line 219, in
>> _call_with_frames_removed
>>   File "C:\Users\Meghanathan\Desktop\java
>> script\drf_api\drf_api\urls.py", line 4, in 
>> from core.views import TestView
>>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py",
>> line 8, in 
>> from core.serializers import PostSerializer
>> ImportError: cannot import name 'PostSerializer' from 'core.serializers'
>> (C:\Users\Meghanathan\Desktop\java script\drf_api\core\serializers.py)
>>
>>
>>
>> On Wednesday, November 13, 2019 at 7:48:00 AM UTC+5:30, MEGA NATHAN wrote:
>>>
>>> Hi.
>>>
>>> i was creating simple REST_framework this api view ,connot import name
>>> in error. how to reslove this error
>>>
>>>
>>>
>>> __.py", line 127, in import_module
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>>   File "", line 1006, in _gcd_import
>>>   File "", line 983, in _find_and_load
>>>   File "", line 967, in
>>> _find_and_load_unlocked
>>>   File "", line 677, in _load_unlocked
>>>   File "", line 728, in exec_module
>>>   File "", line 219, in
>>> _call_with_frames_removed
>>>   File "C:\Users\Meghanathan\Desktop\java
>>> script\drf_api\drf_api\urls.py", line 4, in 
>>> from core.views import test_view
>>>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py",
>>> line 6, in 
>>> from rest_framework.views import APIview
>>> ImportError: cannot import name 'APIview' from 'rest_framework.views'
>>> (C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py)
>>>
>>>
>>> Regards
>>> Meganathan G
>>>
>> --
>> 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/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAPjsHcGjq%3Du3E%2BjdJZg3m8aMymHfHxV3O2KqKya_u_Vy3p96Bw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPjsHcGjq%3Du3E%2BjdJZg3m8aMymHfHxV3O2KqKya_u_Vy3p96Bw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

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


FieldError at / Django models how to reslove this issue....

2019-12-19 Thread MEGA NATHAN
Hi all.

Cannot resolve keyword 'published_date_lte' into field. Choices are: author, 
author_id, comments, create_date, id, published_date, text, title

  

this are models:
from django.db import models
from django.utils import timezone
from django.urls import reverse

# Create your models here.

class Post(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE,)
title = models.CharField(max_length=200)
text = models.TextField()
create_date = models.DateTimeField(default=timezone.now())
published_date = models.DateTimeField(blank=True, null=True) 

def publish(self):
self.published_date = timezone.now()
self.save()

#def approve_comments(self):
#return self.comments.filter(approved_comments=True)

def approved_comments(self):
return self.comments.filter(approved_comment=True)

#def get_absolute_url(self):
#return reverse("post_detail", kwargs={"pk": self.pk})

def __str__self():
return self.title

class Comment(models.Model):
post = models.ForeignKey('blog.post',related_name='comments'
, on_delete=models.CASCADE,)
title = models.CharField(max_length=200)
text = models.TextField()
create_date = models.DateTimeField(default=timezone.now())
published_date = models.DateTimeField(blank=True, null=True) 
approved_comment = models.BooleanField(default=False)

def approve(self):
self.approved_comment = True
self.save()

def get_absolute_url(self):
return reverse('post_list')
 
def __str__(self):
return self.text

And views:

from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
#from django.utils.timezone.now`
from blog.models import Post, Comment
from .forms import PostForm,CommentForm
from django.urls import reverse_lazy
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin 
from django.views.generic import
 (TemplateView, ListView, DetailView, CreateView,
UpdateView, DeleteView)

# Create your views here.

class Aboutview(TemplateView):
template_name = 'about.html'

class PostListView(ListView):
model = Post

def get_queryset(self):
return
 Post.objects.filter(published_date_lte=timezone.now()).order_by(
'-published_date')

class PostDetailView(DetailView):
model = Post

class CreatePostView(LoginRequiredMixin,CreateView):
Login_url = '/Login/'
redirect_field_name = 'blog/post_detail.html'
from_class = PostForm
model = Post

class PostUpdateView(LoginRequiredMixin, UpdateView):
Login_url = '/Login/'
redirect_field_name = 'blog/post_detail.html'
from_class = PostForm
model = Post
   
#class PostDeleteView(loginrequiredMixin, DeleteView):
class PostDeleteView(LoginRequiredMixin,DeleteView):
model = Post
success_url = reverse_lazy('post_list')

class DraftListView(LoginRequiredMixin, ListView):
login_url = '/Login/'
redirect_field_name = 'blog/post_list.html'
model = Post

def get__queryset(self):
return Post.objects.filter(published_date_isnull=True).order_by(
'created_date')


#
##
def add_comment_to_post(request, pk):
post = get_object_or_404(Post, pk=pk)
if request.method == "POST":
form = CommentForm(request.POST)
if form.is_valid():
comment = form.save(commit=False)
comment.post = post
comment.save()
return redirect('post_detail', pk=post.pk)
else:
form = CommentForm()
return render(request, 'blog/comment_form.html', {'form': form})

@login_required
def post_publish(request, pk):
post = get_object_or_404(Post, pk=pk)
post.publish
return redirect('blog/post_detail.html', pk=pk)

#@login_required
def comment_approve(request,pk):
comment = get_object_or_404(comment,pk=pk)
comment.approve()
return redirect('post_detail',pk=comment.post.pk)

#@login_required
def comment_remove(request,pk):
#comment = get_object_or_404(comment, pk=pk)
#comment.remove()
#return redirect('post_detail',pk=comment.post.pk)
comment = get_object_or_404(comment, pk=pk)
post_pk = comment.post.pk
comment_delete()
return redirect('post_detail',pk=comment.post.pk)

*blog urls:*

#from django.conf.urls import path
from django.urls import include, path

from blog import views

urlpatterns = [
path('',views.PostListView.as_view(), name='Post_list'),
path('about', views.Aboutview.as_view, name='about'),
path('Post/(?P\d+)', views.PostDetailView.as_view(), name=
'post_detail'),
path('Post/new/', views.CreatePostView.as_view(), name='post_new'),
path('Post/(?P\d+)/edit/', views.PostUpdateView.as_view(), name=
'post_edit'),
path('Post/(?P\d+)/remove/', views.PostDeleteView.as_view(), name=
'post_

post list view not found NoReverseMatch

2020-01-29 Thread MEGA NATHAN
Hi All.
And this my view page if any bug please tell me.
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from blog.models import Post, Comment
from django.utils import timezone
from blog.forms import PostForm, CommentForm

from django.views.generic import (TemplateView,ListView,
  DetailView,CreateView,
  UpdateView,DeleteView)

from django.urls import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin

class AboutView(TemplateView):
template_name = 'about.html'

class PostListView(ListView):
model = Post

def get_queryset(self):
return
 Post.objects.filter(published_date__lte=timezone.now()).order_by(
'-published_date')

class PostDetailView(DetailView):
model = Post


class CreatePostView(LoginRequiredMixin,CreateView):
login_url = '/login/'
redirect_field_name = 'blog/post_detail.html'

form_class = PostForm

model = Post


class PostUpdateView(LoginRequiredMixin,UpdateView):
login_url = '/login/'
redirect_field_name = 'blog/post_detail.html'

form_class = PostForm

model = Post


class DraftListView(LoginRequiredMixin,ListView):
login_url = '/login/'
redirect_field_name = 'blog/post_draft_list.html'

model = Post

def get_queryset(self):
return Post.objects.filter(published_date__isnull=True).order_by(
'created_date')


class PostDeleteView(LoginRequiredMixin,DeleteView):
model = Post
success_url = reverse_lazy('post_list')

###
## Functions that require a pk match ##
###

@login_required
def post_publish(request, pk):
post = get_object_or_404(Post, pk=pk)
post.publish()
return redirect('post_detail', pk=pk)

@login_required
def add_comment_to_post(request, pk):
post = get_object_or_404(Post, pk=pk)
if request.method == "POST":
form = CommentForm(request.POST)
if form.is_valid():
comment = form.save(commit=False)
comment.post = post
comment.save()
return redirect('post_detail', pk=post.pk)
else:
form = CommentForm()
return render(request, 'blog/comment_form.html', {'form': form})


@login_required
def comment_approve(request, pk):
comment = get_object_or_404(Comment, pk=pk)
comment.approve()
return redirect('post_detail', pk=comment.post.pk)


@login_required
def comment_remove(request, pk):
comment = get_object_or_404(Comment, pk=pk)
post_pk = comment.post.pk
comment.delete()
return redirect('post_detail', pk=post_pk)

-- 
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/f134f405-7f55-4d77-8568-05a9266f1d24%40googlegroups.com.


Re: Python Django Training

2020-02-03 Thread MEGA NATHAN
  I am also interested to attend the training.






*Regards*
Meganathan G



On Mon, Feb 3, 2020 at 6:03 PM Chuck  wrote:

> i am also interested please add me.
>
> Thanks,
> Chuck
>
> On Sunday, February 2, 2020, 10:27:26 PM PST, sagar ninave <
> sagarnin...@gmail.com> wrote:
>
>
> i am also interested please add me
> whats app : 9657445206
> Email : sagarnin...@gmail.com
>
> On Mon, Feb 3, 2020 at 11:33 AM Sarvesh singh  wrote:
>
> i am very passionate to learn django more.
> thanks to you for your support.
>
>
> On Sat, Feb 1, 2020 at 7:12 PM Srikanth K  wrote:
>
> Hi,
>
> I am from Hyderabad. I am Python Developer by Profession. I am eager take
> up any Python , Django Training (online Preferrable or Weekends). Members
> who require can contact me or share me  there idea.
>
> Regards,
> Srikanth.K
>
> --
> 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/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%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/CAK3CZUZ5vwO3ejKf5FpU_i5cQxH%3Dq65TgHKBY44Fu7GDZT2TLw%40mail.gmail.com
> 
> .
>
>
>
> --
>
> 
> sagar ninave
> about.me/sagarninave
> 
>
> --
> 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/CAA6pdZ93Ev%3DqmS9dsnS4jDCeivVni88RnYBo0gRkH3bbkcf-_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/885840711.599527.1580712315881%40mail.yahoo.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/CAEvDBLd%3D9UBxh4rLSxdo-frfh8AQq1jWftdku2w4TgC0RhFXCA%40mail.gmail.com.