Re: how to write Ajax for a Like button in Django

2020-05-17 Thread Motaz Hejaze
The button is submitted but without page refresh

On Mon, 18 May 2020, 3:53 am Ahmed Khairy, 
wrote:

> Hi Motaz,
>
> When I added your code it disabled the function of the button nothing
> happened
>
> On Sunday, May 17, 2020 at 9:30:38 PM UTC-4, Motaz Hejaze wrote:
>>
>> In your like button form in your templates ,
>> try this :
>>
>> 
>>
>> i don't think you need ajax for this , but if you still need it let us know
>>
>>
>> On Mon, 18 May 2020, 2:26 am Gabriel Araya Garcia, 
>> wrote:
>>
>>> Hi Ahmed, I was looking for that during several months and I have found
>>> examples than not run, and therefore I`ve get one conclution: "It`s not
>>> posible to get that functionality in Django". No one could demostrate with
>>> example code.
>>> If you find something, please send me the code.
>>>
>>> Thanks
>>>
>>>
>>> Gabriel Araya Garcia
>>> GMI - Desarrollo de Sistemas Informáticos
>>>
>>>
>>>
>>>
>>> El dom., 17 may. 2020 a las 20:15, Ahmed Khairy ()
>>> escribió:
>>>
 Hi all,

 I need some help writing the ajax for a like button instead of
 refreshing every time a like is posted

 here is the template:

 
 {% csrf_token %}
 {% if user.is_authenticated %}
 {% if liked %}
 >>> class= "btn btn-danger btn-sm" value="{{post.id}}"> Unlike >>> >
 {% else %}
 >>> class= "btn btn-primary btn-sm" value="{{post.id}}"> Like >>> >
 {% endif  %}
 {% else %}
  Login>>> > to Like 
 {{total_likes}} Likes 
 {% endif %}
 

 Here is the urls:
 path('like/', LikeView, name='like_post'),

 here is the views:
 def LikeView(request, pk):
 post = get_object_or_404(Post, id=request.POST.get('post_id'))
 like = False
 if post.likes.filter(id=request.user.id).exists():
 post.likes.remove(request.user)
 like = False

 else:
 post.likes.add(request.user)
 like = True
 return redirect('score:post-detail', pk=pk)

 class PostDetailView(DetailView):
 model = Post
 template_name = "post_detail.html"

 def get_context_data(self, *args, **kwargs):
 context = super(PostDetailView, self).get_context_data()

 stuff = get_object_or_404(Post, id=self.kwargs['pk'])
 total_likes = stuff.total_likes()

 liked = False
 if stuff.likes.filter(id=self.request.user.id).exists():
 liked = True

 context["total_likes"] = total_likes
 context["liked"] = liked
 return context



 --
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/00707977-9b68-4329-a13d-adb9ab7b8813%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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKVvSDCuegzvsZQ_Rfms3yMA_EO914T0yJ_n929mnx7bNDodUA%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/76f6356b-17bc-4697-b6cf-966f01e9217f%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/CAHV4E-fDsKvr77YCUwjttDQJ7nx6f9%2Bj0ZZCByUa1Ygr%3DOoY1Q%40mail.gmail.com.


Re: how to write Ajax for a Like button in Django

2020-05-17 Thread Ahmed Khairy
Hi Motaz,

When I added your code it disabled the function of the button nothing 
happened

On Sunday, May 17, 2020 at 9:30:38 PM UTC-4, Motaz Hejaze wrote:
>
> In your like button form in your templates , 
> try this :
>
> 
>
> i don't think you need ajax for this , but if you still need it let us know
>
>
> On Mon, 18 May 2020, 2:26 am Gabriel Araya Garcia,  > wrote:
>
>> Hi Ahmed, I was looking for that during several months and I have found 
>> examples than not run, and therefore I`ve get one conclution: "It`s not 
>> posible to get that functionality in Django". No one could demostrate with 
>> example code.
>> If you find something, please send me the code.
>>
>> Thanks
>>
>>   
>> Gabriel Araya Garcia
>> GMI - Desarrollo de Sistemas Informáticos
>>
>>
>>
>>
>> El dom., 17 may. 2020 a las 20:15, Ahmed Khairy (> >) escribió:
>>
>>> Hi all,
>>>
>>> I need some help writing the ajax for a like button instead of 
>>> refreshing every time a like is posted 
>>>
>>> here is the template: 
>>>
>>> 
>>> {% csrf_token %}
>>> {% if user.is_authenticated %}
>>> {% if liked %}
>>> >> class= "btn btn-danger btn-sm" value="{{post.id}}"> Unlike >> >
>>> {% else %}
>>> >> class= "btn btn-primary btn-sm" value="{{post.id}}"> Like >> >
>>> {% endif  %}
>>> {% else %}
>>>  Login>> > to Like 
>>> {{total_likes}} Likes 
>>> {% endif %}
>>>  
>>>
>>> Here is the urls:
>>> path('like/', LikeView, name='like_post'),
>>>
>>> here is the views:
>>> def LikeView(request, pk):
>>> post = get_object_or_404(Post, id=request.POST.get('post_id'))
>>> like = False
>>> if post.likes.filter(id=request.user.id).exists():
>>> post.likes.remove(request.user)
>>> like = False
>>>
>>> else:
>>> post.likes.add(request.user)
>>> like = True
>>> return redirect('score:post-detail', pk=pk)
>>>
>>> class PostDetailView(DetailView):
>>> model = Post
>>> template_name = "post_detail.html"
>>>
>>> def get_context_data(self, *args, **kwargs):
>>> context = super(PostDetailView, self).get_context_data()
>>>
>>> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
>>> total_likes = stuff.total_likes()
>>>
>>> liked = False
>>> if stuff.likes.filter(id=self.request.user.id).exists():
>>> liked = True
>>>
>>> context["total_likes"] = total_likes
>>> context["liked"] = liked
>>> return context
>>>
>>>
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/00707977-9b68-4329-a13d-adb9ab7b8813%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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAKVvSDCuegzvsZQ_Rfms3yMA_EO914T0yJ_n929mnx7bNDodUA%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/76f6356b-17bc-4697-b6cf-966f01e9217f%40googlegroups.com.


Re: how to write Ajax for a Like button in Django

2020-05-17 Thread Motaz Hejaze
In your like button form in your templates ,
try this :



i don't think you need ajax for this , but if you still need it let us know


On Mon, 18 May 2020, 2:26 am Gabriel Araya Garcia, <
gabrielaraya2...@gmail.com> wrote:

> Hi Ahmed, I was looking for that during several months and I have found
> examples than not run, and therefore I`ve get one conclution: "It`s not
> posible to get that functionality in Django". No one could demostrate with
> example code.
> If you find something, please send me the code.
>
> Thanks
>
>
> Gabriel Araya Garcia
> GMI - Desarrollo de Sistemas Informáticos
>
>
>
>
> El dom., 17 may. 2020 a las 20:15, Ahmed Khairy (<
> ahmed.heshamel...@gmail.com>) escribió:
>
>> Hi all,
>>
>> I need some help writing the ajax for a like button instead of refreshing
>> every time a like is posted
>>
>> here is the template:
>>
>> 
>> {% csrf_token %}
>> {% if user.is_authenticated %}
>> {% if liked %}
>> > class= "btn btn-danger btn-sm" value="{{post.id}}"> Unlike > >
>> {% else %}
>> > class= "btn btn-primary btn-sm" value="{{post.id}}"> Like > >
>> {% endif  %}
>> {% else %}
>>  Login> > to Like 
>> {{total_likes}} Likes 
>> {% endif %}
>> 
>>
>> Here is the urls:
>> path('like/', LikeView, name='like_post'),
>>
>> here is the views:
>> def LikeView(request, pk):
>> post = get_object_or_404(Post, id=request.POST.get('post_id'))
>> like = False
>> if post.likes.filter(id=request.user.id).exists():
>> post.likes.remove(request.user)
>> like = False
>>
>> else:
>> post.likes.add(request.user)
>> like = True
>> return redirect('score:post-detail', pk=pk)
>>
>> class PostDetailView(DetailView):
>> model = Post
>> template_name = "post_detail.html"
>>
>> def get_context_data(self, *args, **kwargs):
>> context = super(PostDetailView, self).get_context_data()
>>
>> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
>> total_likes = stuff.total_likes()
>>
>> liked = False
>> if stuff.likes.filter(id=self.request.user.id).exists():
>> liked = True
>>
>> context["total_likes"] = total_likes
>> context["liked"] = liked
>> return context
>>
>>
>>
>> --
>> 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/00707977-9b68-4329-a13d-adb9ab7b8813%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/CAKVvSDCuegzvsZQ_Rfms3yMA_EO914T0yJ_n929mnx7bNDodUA%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/CAHV4E-d4Bz%2BWbq_Ljio0fBtS_dQ1mtSB1sE6SGt%3Dz4Cxt%2BVZSA%40mail.gmail.com.


Re: How to create custom tag - break for tamplate?

2020-05-17 Thread Gabriel Araya Garcia
Sergei, you just to have put an conditional flag. It could be defined in
your view. Example:
flag_ = 0
if pedrito > 16
   flag_ = 1

and flag_ send it in context

in template you must include:
{%  if flag_ == 0 %}
  brek
  etc.

Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos
99.7721.15.70



El dom., 17 may. 2020 a las 11:10, Sergei Sokov ()
escribió:

> views.py
>
> class MyClassCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
> CreateView):
> model = MyClass
> template_name = 'mypage.html'
> form_class = MyClassForm
> success_url = reverse_lazy('mypage')
> success_msg = 'сохранён'
> def get_context_data(self, **kwargs):
> kwargs['list_mylist'] = MyClass.objects.all()
> list_mylist = kwargs['list_mylist']
> for i in list_mylist:
> if i.author == self.request.user:
> print('my_button')
> kwargs['my_button'] = True
> break
> return super().get_context_data(**kwargs)
>
> template
>
> {% if my_button %}
>{% for i in list_mylist %}
>  {% if request.user == i.author %}
> 
>   кнопка первая
> 
>  {% endif %}
>{% endfor %}
> {% else %}
>  data-target="#class">
>   кнопка вторая
> 
> {% endif %}
>
>
>
>
> суббота, 16 мая 2020 г., 20:05:01 UTC+2 пользователь Sergei Sokov написал:
>>
>> Hi
>> I would like abort a loop in my template.
>> How to create custom tag - break for tamplate?
>>
> --
> 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/5f05fc6e-13a0-47ba-be33-9c860dc48dee%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/CAKVvSDDFFeTzd_MhvK4ebD9eGRd%2BJ%2Btg8gVy9_Sdv_Y8HnTmzA%40mail.gmail.com.


Re: how to write Ajax for a Like button in Django

2020-05-17 Thread Gabriel Araya Garcia
Hi Ahmed, I was looking for that during several months and I have found
examples than not run, and therefore I`ve get one conclution: "It`s not
posible to get that functionality in Django". No one could demostrate with
example code.
If you find something, please send me the code.

Thanks


Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos




El dom., 17 may. 2020 a las 20:15, Ahmed Khairy (<
ahmed.heshamel...@gmail.com>) escribió:

> Hi all,
>
> I need some help writing the ajax for a like button instead of refreshing
> every time a like is posted
>
> here is the template:
>
>   method='POST'>
> {% csrf_token %}
> {% if user.is_authenticated %}
> {% if liked %}
>  = "btn btn-danger btn-sm" value="{{post.id}}"> Unlike  >
> {% else %}
>  = "btn btn-primary btn-sm" value="{{post.id}}"> Like  >
> {% endif  %}
> {% else %}
>  Login > to Like 
> {{total_likes}} Likes 
> {% endif %}
> 
>
> Here is the urls:
> path('like/', LikeView, name='like_post'),
>
> here is the views:
> def LikeView(request, pk):
> post = get_object_or_404(Post, id=request.POST.get('post_id'))
> like = False
> if post.likes.filter(id=request.user.id).exists():
> post.likes.remove(request.user)
> like = False
>
> else:
> post.likes.add(request.user)
> like = True
> return redirect('score:post-detail', pk=pk)
>
> class PostDetailView(DetailView):
> model = Post
> template_name = "post_detail.html"
>
> def get_context_data(self, *args, **kwargs):
> context = super(PostDetailView, self).get_context_data()
>
> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
> total_likes = stuff.total_likes()
>
> liked = False
> if stuff.likes.filter(id=self.request.user.id).exists():
> liked = True
>
> context["total_likes"] = total_likes
> context["liked"] = liked
> return context
>
>
>
> --
> 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/00707977-9b68-4329-a13d-adb9ab7b8813%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/CAKVvSDCuegzvsZQ_Rfms3yMA_EO914T0yJ_n929mnx7bNDodUA%40mail.gmail.com.


how to write Ajax for a Like button in Django

2020-05-17 Thread Ahmed Khairy
Hi all,

I need some help writing the ajax for a like button instead of refreshing 
every time a like is posted 

here is the template: 


{% csrf_token %}
{% if user.is_authenticated %}
{% if liked %}
 Unlike 
{% else %}
 Like 
{% endif  %}
{% else %}
 Login to Like 
{{total_likes}} Likes 
{% endif %}
 

Here is the urls:
path('like/', LikeView, name='like_post'),

here is the views:
def LikeView(request, pk):
post = get_object_or_404(Post, id=request.POST.get('post_id'))
like = False
if post.likes.filter(id=request.user.id).exists():
post.likes.remove(request.user)
like = False

else:
post.likes.add(request.user)
like = True
return redirect('score:post-detail', pk=pk)

class PostDetailView(DetailView):
model = Post
template_name = "post_detail.html"

def get_context_data(self, *args, **kwargs):
context = super(PostDetailView, self).get_context_data()

stuff = get_object_or_404(Post, id=self.kwargs['pk'])
total_likes = stuff.total_likes()

liked = False
if stuff.likes.filter(id=self.request.user.id).exists():
liked = True

context["total_likes"] = total_likes
context["liked"] = liked
return context



-- 
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/00707977-9b68-4329-a13d-adb9ab7b8813%40googlegroups.com.


Re: deploying django project with mod_wsgi and apache

2020-05-17 Thread みやうち`
I found out part of my code has problem, althogh I don't know why it didn't 
output an error.

Anyway, thank you for reply.

-- 
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/106caf50-87ae-4961-acf8-cae0ba85b728%40googlegroups.com.


How to resize image from Django ckeditor_uploader in the HTML template while rendering?

2020-05-17 Thread Ali Ahammad
I am using Django ckeditor_uploader to make a post view for a blog. But while 
rendering in the template I wanted to render image separately from the post 
content texts.

My main goal is to set the image separately on the template on top and resizing 
it. And I can set more pictures inside the post  but the top one will be 
highlighted and rendered in different HTML page.

Is there any way?

I tried to use ckeditor widget but it is just customizing the toolbar of 
ckeditor

Please let me know if you have any idea 

-- 
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/4b148528-7b15-4d39-8763-5f3a0f1931b6%40googlegroups.com.


Re: How to create custom tag - break for tamplate?

2020-05-17 Thread Sergei Sokov


views.py

class MyClassCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
CreateView):
model = MyClass
template_name = 'mypage.html'
form_class = MyClassForm
success_url = reverse_lazy('mypage')
success_msg = 'сохранён'
def get_context_data(self, **kwargs):
kwargs['list_mylist'] = MyClass.objects.all()
list_mylist = kwargs['list_mylist']
for i in list_mylist:
if i.author == self.request.user:
print('my_button')
kwargs['my_button'] = True
break
return super().get_context_data(**kwargs)

template

{% if my_button %}
   {% for i in list_mylist %}
 {% if request.user == i.author %}

  кнопка первая

 {% endif %}
   {% endfor %}
{% else %}

  кнопка вторая

{% endif %}




суббота, 16 мая 2020 г., 20:05:01 UTC+2 пользователь Sergei Sokov написал:
>
> Hi
> I would like abort a loop in my template.
> How to create custom tag - break for tamplate?
>

-- 
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/5f05fc6e-13a0-47ba-be33-9c860dc48dee%40googlegroups.com.


Re: Exception in tests when deleting users in Django

2020-05-17 Thread אורי
אורי‎
5:54 PM (1 minute ago)
to pyweb-il
Hi,

I found out that changing:

User.objects.all().exclude(pk=self.user_1.pk).delete()

To:

for user in User.objects.all().exclude(pk=self.user_1.pk):
user.delete()

Fixes the problem. What does it mean? Does it mean I can't safely delete
users in bulk by .delete()? And if it does, how do I disable it so trying
to delete users in bulk will raise an exception?

אורי
u...@speedy.net


‪On Sun, May 17, 2020 at 5:56 PM ‫אורי‬‎  wrote:‬

> Hi,
>
> I'm creating a new test and it has users and I delete them:
>
> User.objects.all().exclude(pk=self.user_1.pk).delete()
>
> The User model has related models with on_delete=models.CASCADE which
> should be deleted as well.
>
> But in my test, I get this exception:
>
> ==
> ERROR: test_like_list_views_titles_with_empty_lists
> (speedy.match.likes.tests.test_views.LikeListViewsEnglishTestCase)
> --
> Traceback (most recent call last):
>   File "env\lib\site-packages\django\db\backends\utils.py", line 84, in
> _execute
> return self.cursor.execute(sql)
> psycopg2.errors.ForeignKeyViolation: insert or update on table
> "net_accounts_siteprofile" violates foreign key constraint
> "net_accounts_sitepro_user_id_c96775a1_fk_accounts_"
> DETAIL:  Key (user_id)=(403828609159078) is not present in table
> "accounts_user".
>
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "env\lib\site-packages\django\test\testcases.py", line 274, in
> __call__
> self._post_teardown()
>   File "env\lib\site-packages\django\test\testcases.py", line 1009, in
> _post_teardown
> self._fixture_teardown()
>   File "env\lib\site-packages\django\test\testcases.py", line 1177, in
> _fixture_teardown
> connections[db_name].check_constraints()
>   File "env\lib\site-packages\django\db\backends\postgresql\base.py", line
> 276, in check_constraints
> self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE')
>   File "env\lib\site-packages\django\db\backends\utils.py", line 68, in
> execute
> return self._execute_with_wrappers(sql, params, many=False,
> executor=self._execute)
>   File "env\lib\site-packages\django\db\backends\utils.py", line 77, in
> _execute_with_wrappers
> return executor(sql, params, many, context)
>   File "env\lib\site-packages\django\db\backends\utils.py", line 86, in
> _execute
> return self.cursor.execute(sql, params)
>   File "env\lib\site-packages\django\db\utils.py", line 90, in __exit__
> raise dj_exc_value.with_traceback(traceback) from exc_value
>   File "env\lib\site-packages\django\db\backends\utils.py", line 84, in
> _execute
> return self.cursor.execute(sql)
> django.db.utils.IntegrityError: insert or update on table
> "net_accounts_siteprofile" violates foreign key constraint
> "net_accounts_sitepro_user_id_c96775a1_fk_accounts_"
> DETAIL:  Key (user_id)=(403828609159078) is not present in table
> "accounts_user".
>
>
> --
> Ran 1 test in 7.425s
>
> I think this exception is because the users I
> deleted. net_accounts_siteprofile refers to the SiteProfile model which
> should be deleted when deleting a user by on_delete=models.CASCADE .
>
> What is the problem and how do I fix it?
> אורי
> u...@speedy.net
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABD5YeFM4aYF5EEA4UsMTWs3QG-b73uzCAyf%3DCm%3DraRRTbM%3DGA%40mail.gmail.com.


Exception in tests when deleting users in Django

2020-05-17 Thread אורי
Hi,

I'm creating a new test and it has users and I delete them:

User.objects.all().exclude(pk=self.user_1.pk).delete()

The User model has related models with on_delete=models.CASCADE which
should be deleted as well.

But in my test, I get this exception:

==
ERROR: test_like_list_views_titles_with_empty_lists
(speedy.match.likes.tests.test_views.LikeListViewsEnglishTestCase)
--
Traceback (most recent call last):
  File "env\lib\site-packages\django\db\backends\utils.py", line 84, in
_execute
return self.cursor.execute(sql)
psycopg2.errors.ForeignKeyViolation: insert or update on table
"net_accounts_siteprofile" violates foreign key constraint
"net_accounts_sitepro_user_id_c96775a1_fk_accounts_"
DETAIL:  Key (user_id)=(403828609159078) is not present in table
"accounts_user".


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "env\lib\site-packages\django\test\testcases.py", line 274, in
__call__
self._post_teardown()
  File "env\lib\site-packages\django\test\testcases.py", line 1009, in
_post_teardown
self._fixture_teardown()
  File "env\lib\site-packages\django\test\testcases.py", line 1177, in
_fixture_teardown
connections[db_name].check_constraints()
  File "env\lib\site-packages\django\db\backends\postgresql\base.py", line
276, in check_constraints
self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE')
  File "env\lib\site-packages\django\db\backends\utils.py", line 68, in
execute
return self._execute_with_wrappers(sql, params, many=False,
executor=self._execute)
  File "env\lib\site-packages\django\db\backends\utils.py", line 77, in
_execute_with_wrappers
return executor(sql, params, many, context)
  File "env\lib\site-packages\django\db\backends\utils.py", line 86, in
_execute
return self.cursor.execute(sql, params)
  File "env\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
  File "env\lib\site-packages\django\db\backends\utils.py", line 84, in
_execute
return self.cursor.execute(sql)
django.db.utils.IntegrityError: insert or update on table
"net_accounts_siteprofile" violates foreign key constraint
"net_accounts_sitepro_user_id_c96775a1_fk_accounts_"
DETAIL:  Key (user_id)=(403828609159078) is not present in table
"accounts_user".


--
Ran 1 test in 7.425s

I think this exception is because the users I
deleted. net_accounts_siteprofile refers to the SiteProfile model which
should be deleted when deleting a user by on_delete=models.CASCADE .

What is the problem and how do I fix it?
אורי
u...@speedy.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABD5YeFZgpzdXdzGeKPerx8pkVzWStX0zvcW8Yhg1jak0-5DBw%40mail.gmail.com.


Help with Paginating my api views

2020-05-17 Thread Sunday Iyanu Ajayi
I made use of the global pagination ( which is setup on settings.py)  and
it worked fine only on generic viewsets .

I am trying to make use of pagination in a custom view and it is really
challenging. below is a screenshot of my api view.

I need help on how to apply pagination on an APIView shown below:

[image: image.png]

[image: image.png]
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@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/CAKYSAw3d%3DjsORDXB89oxb%3DVNF6P9Oj-5_-2vfMkO7g%2BW4UUe9A%40mail.gmail.com.


Re: Tablespace is missing for a table from storage engine InnoDB

2020-05-17 Thread Kasper Laudrup

Hi Ifeanyi,

On 17/05/2020 16.04, Ifeanyi Chielo wrote:
I think the full error report below will provide more information on the 
problem




That's an error from MySQL. I doubt this is related to Django.

This was what I could find:

https://bobcares.com/blog/mysql-tablespace-is-missing-for-table/

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/c0376e29-7ecd-7714-ea0e-adba744a875b%40stacktrace.dk.


No template exist Django

2020-05-17 Thread Anonymous Patel
https://youtu.be/wDu5nvU1rNY

Check this video out if you are facing error as no template exist,

Follow this channel Errormania.

-- 
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/CAF_9CiuUZ%3D%2Bd-Nm6cGWbUAzmhvG-R9oYubrAypF%3Dp1E%3Ddj%3DMVg%40mail.gmail.com.


Re: how to add an extra field in an admin form (not part of the model)

2020-05-17 Thread Carles Pina i Estany


Thanks very much! I've quickly watched the video... sadly the video
helps to add fields into the registration form, not in the admin section
(the, by default, /admin URL).

As a side note and for future reference anyone here: one of my attempts
on Friday was following this one:
https://gist.github.com/riklomas/511440

This uses exactly my first approach. And it works. But only because the
default models.User already has an "email" field (not displayed by 
default in http://localhost:8000/admin/auth/user/add/ )

And in a "desperate" way I realised also that UserAdmin overrides
get_form and this works:
https://stackoverflow.com/questions/54262075/difference-between-add-form-and-form

I did "MyAdminForm" doing the same as Django in the UserAdmin but this
only works if the model has the field to be added (this was sad, I
realised too late that models.User has it!)

Anyway, if anyone has added a field in a model form that doesn't belong
to the model: any pointers, help, ideas are welcomed!

Thanks for any ideas!

Carles

On May/17/2020, Anonymous Patel wrote:
> https://youtu.be/lHQI9ydQlSU
> 
> Try this video it might help, it helped me for the same problem.
> 
> Raj Patel
> 
> On Sun, 17 May, 2020, 6:50 pm Carles Pina i Estany,  wrote:
> 
> >
> > Hi,
> >
> > Last week I tried to do something in admin but it didn't work as I had
> > guessed.
> >
> > The simplification of what I wanted is to have an extra field in the admin
> > form.
> >
> > What I tried to do is what I do in forms outside admin:
> >
> > -
> > class MyModelForm(forms.ModelForm):
> > def __init__(self, *args, **kwargs):
> > super().__init__(*args, **kwargs)
> > self.fields['extra_field'] = forms.CharField(max_length=100)
> >
> > def save(self, *args, **kwargs):
> > # here I would like to have some code using the new extra_field
> >pass
> >
> > class Meta:
> > model = MyModel
> > fields = ['amount', 'project']
> >
> > class MyModelAdmin(admin.ModelAdmin):
> > form = MyModelForm
> > -
> >
> > The "extra_field" is not displayed in the "Add MyModel" form in the admin.
> >
> > After this I tried different approaches too long to explain here (I mean,
> > all
> > failed in different ways).
> >
> > Does any of you expand an admin form with a new field? any idea,
> > references,
> > etc. welcomed!
> >
> > Thank you very much,
> >
> > --
> > Carles Pina i Estany
> >
> > --
> > 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/20200517111312.GA23248%40pina.cat
> > .
> >
> 
> -- 
> 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/CAF_9Cit_cQ2ErCKsKNe4TgVxF%2BAcjatq0fYgzOyf5P0cDD7Skg%40mail.gmail.com.
-- 
Carles Pina i Estany

-- 
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/20200517140828.GA30392%40pina.cat.


Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-17 Thread Sunday Iyanu Ajayi
Thanks
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Sat, May 16, 2020 at 1:32 AM John McClain  wrote:

> I'm not sure this is feasible. The issue is likely about getting paid for
> you and for them about getting what they paid for. There is no work-a-round
> for this dynamic in coding other than to use sandbox server you control for
> version control. Once they approve the iterations and pay you can transfer
> the code. Otherwise, you are going to have to transfer the code and hope
> you get paid.
>
> On Fri, 15 May 2020 at 14:21, Sunday Iyanu Ajayi 
> wrote:
>
>> I am working for a client that wants to deploy a project I am working on
>> in a remote server and I will like to project my source code when deployed
>> so that they will not be able to mess with it.
>>
>> How can  I  go about it please?
>>
>> *AJAYI Sunday *
>> (+234) 806 771 5394
>> *sunnexaj...@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/CAKYSAw2PjNzS0Kutg_-DMvwDqQoTrkWpvjwp7K-6JFR1XZ_%3DLQ%40mail.gmail.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_rMjbvxcRWLT03Z-_426Kv%3DfLtPCScBObFJQSisAnkpbw%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/CAKYSAw3-D-EqKfm6ug_AbzTvGGJUFogCcfT1dk_iiLub_B4XvA%40mail.gmail.com.


Re: how to add an extra field in an admin form (not part of the model)

2020-05-17 Thread Anonymous Patel
https://youtu.be/lHQI9ydQlSU

Try this video it might help, it helped me for the same problem.

Raj Patel

On Sun, 17 May, 2020, 6:50 pm Carles Pina i Estany,  wrote:

>
> Hi,
>
> Last week I tried to do something in admin but it didn't work as I had
> guessed.
>
> The simplification of what I wanted is to have an extra field in the admin
> form.
>
> What I tried to do is what I do in forms outside admin:
>
> -
> class MyModelForm(forms.ModelForm):
> def __init__(self, *args, **kwargs):
> super().__init__(*args, **kwargs)
> self.fields['extra_field'] = forms.CharField(max_length=100)
>
> def save(self, *args, **kwargs):
> # here I would like to have some code using the new extra_field
>pass
>
> class Meta:
> model = MyModel
> fields = ['amount', 'project']
>
> class MyModelAdmin(admin.ModelAdmin):
> form = MyModelForm
> -
>
> The "extra_field" is not displayed in the "Add MyModel" form in the admin.
>
> After this I tried different approaches too long to explain here (I mean,
> all
> failed in different ways).
>
> Does any of you expand an admin form with a new field? any idea,
> references,
> etc. welcomed!
>
> Thank you very much,
>
> --
> Carles Pina i Estany
>
> --
> 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/20200517111312.GA23248%40pina.cat
> .
>

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


how to add an extra field in an admin form (not part of the model)

2020-05-17 Thread Carles Pina i Estany


Hi,

Last week I tried to do something in admin but it didn't work as I had guessed.

The simplification of what I wanted is to have an extra field in the admin
form.

What I tried to do is what I do in forms outside admin:

-
class MyModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['extra_field'] = forms.CharField(max_length=100)

def save(self, *args, **kwargs):
# here I would like to have some code using the new extra_field
   pass

class Meta:
model = MyModel 
fields = ['amount', 'project']

class MyModelAdmin(admin.ModelAdmin):
form = MyModelForm
-

The "extra_field" is not displayed in the "Add MyModel" form in the admin.

After this I tried different approaches too long to explain here (I mean, all
failed in different ways).

Does any of you expand an admin form with a new field? any idea, references,
etc. welcomed!

Thank you very much,

-- 
Carles Pina i Estany

-- 
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/20200517111312.GA23248%40pina.cat.


Re: Django back button issue after log-out

2020-05-17 Thread sidharth sharma
did you find the solution for this ?

On Monday, December 17, 2012 at 6:39:25 PM UTC+5:30, ke1g wrote:
>
>
>
> On Mon, Dec 17, 2012 at 5:14 AM, Ashish Sable  > wrote:
>
>>
>> I have written simple registration(login,logout) Django apps.
>>  when i click on logout and then back button from browser 
>> it shows me previous page. it should redirect me to login page. please 
>> help
>>
>>
>  The back button in your browser just shows you cached stuff.  It doesn't 
> contact the server, so there is nothing Django can do.
>

-- 
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/6ebfcfbe-f82e-4caf-84aa-8c029811fcd9%40googlegroups.com.


Re: Tablespace is missing for a table from storage engine InnoDB

2020-05-17 Thread Ifeanyi Chielo
thanks, I will go through it

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo 



On Sun, May 17, 2020 at 12:40 PM Kasper Laudrup 
wrote:

> Hi Ifeanyi,
>
> On 17/05/2020 13.35, Ifeanyi Chielo wrote:
> > Dear all
> > I am unable to access my phpmyadmin  tables either via django or
> > directtly, I always meet this error. " #1030 - Got error 194 "Tablespace
> > is missing for a table" from storage engine InnoDB"
> > Please I need your assistance
> >
>
> I think you would have a much better chance of getting assistance here:
>
> https://www.phpmyadmin.net/support/
>
> 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/565b0156-b1f2-4c34-8e04-55081573bb2a%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/django-users/565b0156-b1f2-4c34-8e04-55081573bb2a%40googlegroups.com?utm_medium=email_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/56425dfd-3e17-c21f-3bb6-d765ccc1d82e%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/CAOcS8H0rCCDuoFHD8xQb7z%3D6CSS1Yvexnn1bPKq9O1Le6ZC_aA%40mail.gmail.com.


I am facing issues in sharing module.

2020-05-17 Thread Akshat Zala
I wish to share the post with friends in django application.

My project flow chart is as follows:


1. User registers for an account.
2. User will recieve the email confirmation
3. By clicking on the link in email , he gets redirected to login page, 
where he can login and he will see account successfully activated.

4. He/She can create /update/delete  the post.
5. He can view his profile,and update the profile.

6. He can search for friends through search bar by either of their first 
name, last name, username and email address.
7. Results will be seen in tabular format.
8. By clicking on the hyperlink in add friend column a mail will be sent to 
the friend_request with a hyperlink containing a template with 
accept/reject buttons.
9. By clicking on either of the buttons, status of friend_request will be 
updated accordingly  in the database as well as in the friend list template.

Pending job is to Share the post with friend.

10. Now it is showing all the post to every registered user.

   
Regards,

Akshat Zala

-- 
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/b6de9cbb-608d-44ad-a9c7-bf5b0e2cd9bd%40googlegroups.com.


Re: Tablespace is missing for a table from storage engine InnoDB

2020-05-17 Thread Kasper Laudrup

Hi Ifeanyi,

On 17/05/2020 13.35, Ifeanyi Chielo wrote:

Dear all
I am unable to access my phpmyadmin  tables either via django or 
directtly, I always meet this error. " #1030 - Got error 194 "Tablespace 
is missing for a table" from storage engine InnoDB"

Please I need your assistance



I think you would have a much better chance of getting assistance here:

https://www.phpmyadmin.net/support/

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/565b0156-b1f2-4c34-8e04-55081573bb2a%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/56425dfd-3e17-c21f-3bb6-d765ccc1d82e%40stacktrace.dk.


Tablespace is missing for a table from storage engine InnoDB

2020-05-17 Thread Ifeanyi Chielo
Dear all
I am unable to access my phpmyadmin  tables either via django or directtly, 
I always meet this error. " #1030 - Got error 194 "Tablespace is missing 
for a table" from storage engine InnoDB"
Please I need your assistance

-- 
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/565b0156-b1f2-4c34-8e04-55081573bb2a%40googlegroups.com.


Re: Bootstrap drop down menu not clickable.

2020-05-17 Thread Miracle
Have you tried the same drop down menu code in a plain html file?

Without django involved.

Just create a html file, put the menu code and boostrap code and test if it
works in the first place.  This issue might be the dropdown configuration.

On Sun, 17 May 2020, 10:49 am Miracle,  wrote:

> Hey Sunday,
>
> Please check this...
>
> https://stackoverflow.com/a/61849839/11000813
>
> On Sun, 17 May 2020, 10:28 am sunday honesty, 
> wrote:
>
>> Thanks for replying...
>> I just downloaded it now following the guide on the doc you sent me.
>> I have added it to my installed app and requirements.txt.
>> I loaded it at the top of my template and it didn't work. I then included
>> it in the {% block content %} as suggested by a member here yesterday, yet
>> it didn't work.
>> I don't know what's just wrong.
>> You can take a look at my base.html file
>> https://pastebin.com/4gVcN2si
>>
>> On Sun, May 17, 2020, 9:50 AM Kasper Laudrup 
>> wrote:
>>
>>> Hi Sunday
>>>
>>> On 17/05/2020 08.33, sunday honesty wrote:
>>> > That's what I did... But the question is do I need to download
>>> > django-bootstrap with pip before I can use compiled bootstrap I have
>>> > downloaded?
>>> > Isn't django-bootstrap different from bootstrap?
>>> >
>>>
>>> The compiled bootstrap you have downloaded is just a bunch of CSS
>>> styles. You have to do some manual work to make that work with you
>>> Django project.
>>>
>>> The whole point of something like the django-bootstrap package is to
>>> avoid that manual work.
>>>
>>> Have you tried following the very simple installation instructions:
>>>
>>> https://django-bootstrap4.readthedocs.io/en/latest/installation.html
>>>
>>> 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/3b8a4124-4a8a-34f1-a4b4-3387aed6cc6e%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/CALcuGNs6VS_ix30Cxf-f-S64v5USTm4%2Bx6LEXKjEhYK1GrK7ww%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/CADZv-jC5LF7EMcJ63a-6AxKwQKJ8Q3aKqLCpnM6ZDZfLN1t%2BLw%40mail.gmail.com.


Re: Bootstrap drop down menu not clickable.

2020-05-17 Thread Miracle
Hey Sunday,

Please check this...

https://stackoverflow.com/a/61849839/11000813

On Sun, 17 May 2020, 10:28 am sunday honesty, 
wrote:

> Thanks for replying...
> I just downloaded it now following the guide on the doc you sent me.
> I have added it to my installed app and requirements.txt.
> I loaded it at the top of my template and it didn't work. I then included
> it in the {% block content %} as suggested by a member here yesterday, yet
> it didn't work.
> I don't know what's just wrong.
> You can take a look at my base.html file
> https://pastebin.com/4gVcN2si
>
> On Sun, May 17, 2020, 9:50 AM Kasper Laudrup 
> wrote:
>
>> Hi Sunday
>>
>> On 17/05/2020 08.33, sunday honesty wrote:
>> > That's what I did... But the question is do I need to download
>> > django-bootstrap with pip before I can use compiled bootstrap I have
>> > downloaded?
>> > Isn't django-bootstrap different from bootstrap?
>> >
>>
>> The compiled bootstrap you have downloaded is just a bunch of CSS
>> styles. You have to do some manual work to make that work with you
>> Django project.
>>
>> The whole point of something like the django-bootstrap package is to
>> avoid that manual work.
>>
>> Have you tried following the very simple installation instructions:
>>
>> https://django-bootstrap4.readthedocs.io/en/latest/installation.html
>>
>> 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/3b8a4124-4a8a-34f1-a4b4-3387aed6cc6e%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/CALcuGNs6VS_ix30Cxf-f-S64v5USTm4%2Bx6LEXKjEhYK1GrK7ww%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/CADZv-jBb4PBcRw21o81j4ygv8B2WQsr80KoqYPHGnoxfYjcp0Q%40mail.gmail.com.


Re: Bootstrap drop down menu not clickable.

2020-05-17 Thread Kasper Laudrup

Hi Sunday,

On 17/05/2020 11.27, sunday honesty wrote:

Thanks for replying...
I just downloaded it now following the guide on the doc you sent me.
I have added it to my installed app and requirements.txt.
I loaded it at the top of my template and it didn't work. I then 
included it in the {% block content %} as suggested by a member here 
yesterday, yet it didn't work.

I don't know what's just wrong.
You can take a look at my base.html file
https://pastebin.com/4gVcN2si



I would definitely load it at the top of the template as seems to be 
what is suggested in the quickstart guide:


https://django-bootstrap4.readthedocs.io/en/latest/quickstart.html

I'm not sure what you mean by "not working". Would be nice with some 
more details. Consider using the developer tools of your browser and see 
if there are any errors in the console log.:


Does the bootstrap CSS files load?
Any javascript errors?
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/da762a31-0ee2-a2d0-bd0c-2a8b6daf3e72%40stacktrace.dk.


Re: Bootstrap drop down menu not clickable.

2020-05-17 Thread sunday honesty
Thanks for replying...
I just downloaded it now following the guide on the doc you sent me.
I have added it to my installed app and requirements.txt.
I loaded it at the top of my template and it didn't work. I then included
it in the {% block content %} as suggested by a member here yesterday, yet
it didn't work.
I don't know what's just wrong.
You can take a look at my base.html file
https://pastebin.com/4gVcN2si

On Sun, May 17, 2020, 9:50 AM Kasper Laudrup  wrote:

> Hi Sunday
>
> On 17/05/2020 08.33, sunday honesty wrote:
> > That's what I did... But the question is do I need to download
> > django-bootstrap with pip before I can use compiled bootstrap I have
> > downloaded?
> > Isn't django-bootstrap different from bootstrap?
> >
>
> The compiled bootstrap you have downloaded is just a bunch of CSS
> styles. You have to do some manual work to make that work with you
> Django project.
>
> The whole point of something like the django-bootstrap package is to
> avoid that manual work.
>
> Have you tried following the very simple installation instructions:
>
> https://django-bootstrap4.readthedocs.io/en/latest/installation.html
>
> 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/3b8a4124-4a8a-34f1-a4b4-3387aed6cc6e%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/CALcuGNs6VS_ix30Cxf-f-S64v5USTm4%2Bx6LEXKjEhYK1GrK7ww%40mail.gmail.com.


Re: Bootstrap drop down menu not clickable.

2020-05-17 Thread Kasper Laudrup

Hi Sunday

On 17/05/2020 08.33, sunday honesty wrote:
That's what I did... But the question is do I need to download 
django-bootstrap with pip before I can use compiled bootstrap I have 
downloaded?

Isn't django-bootstrap different from bootstrap?



The compiled bootstrap you have downloaded is just a bunch of CSS 
styles. You have to do some manual work to make that work with you 
Django project.


The whole point of something like the django-bootstrap package is to 
avoid that manual work.


Have you tried following the very simple installation instructions:

https://django-bootstrap4.readthedocs.io/en/latest/installation.html

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/3b8a4124-4a8a-34f1-a4b4-3387aed6cc6e%40stacktrace.dk.


Re: Bootstrap drop down menu not clickable.

2020-05-17 Thread sunday honesty
That's what I did... But the question is do I need to download
django-bootstrap with pip before I can use compiled bootstrap I have
downloaded?
Isn't django-bootstrap different from bootstrap?

On Sun, May 17, 2020, 2:49 AM Clive Bruton  wrote:

>
> On 16 May 2020, at 15:43, sunday honesty wrote:
>
> > I included it to installed app and got an error message on the
> > console. "Module not found, no module named bootstrap 4"
>
> "bootstrap4"
>
>
> -- 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/7552335C-16B0-4114-B1F3-5A3F8C1CD02A%40indx.co.uk
> .
>

-- 
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/CALcuGNsiD-Lsr87Zxodnx0s_%3DMe-bcUJzscz6XQHcxqwAy%2Bj2g%40mail.gmail.com.