Templates in Django

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

I noticed that an app's template can't extend a template with exactly the
same path in another app. Recently I had a need to extend such a template,
called 'accounts/edit_profile/base.html', so I renamed it
to 'accounts/edit_profile/core_base.html' and added a new
template 'accounts/edit_profile/base.html' which only contains one line:

{% extends 'accounts/edit_profile/core_base.html' %}

And then, in the other app, I extend the same template with my changes:

{% extends 'accounts/edit_profile/core_base.html' %}


{% load core_tags_and_filters %}
{% load i18n %}

{% block edit_profile_links_1 %}
{% if request.user.profile.is_active %}


{% endif %}
{% endblock %}

Is this the correct way to do this? Or is there a better way to extend
templates?

Thanks,
Uri.

אורי
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/CABD5YeF8uDqt9uY%3Dy70ev-UotZdUV28dFLK4awAXvSDnukmFTg%40mail.gmail.com.


Re: Exception Value: Related Field got invalid lookup: value

2020-05-14 Thread Ahmed Khairy
In the views file 

in the class PostListView(ListView):


   1. 
   
   def get_queryset(self, **kwargs):
   
   2. 
   
   queryset = super(PostListView, self).get_queryset(**kwargs)
   
   

   1. 
   
   return queryset.annotate(
   
   …


   1. 
   
   total_liked=Count(
   
   2. 
   
   'likes',
   
   3. 
   
   filter=Q(likes__value="Like")
   
   4. 
   
   )).annotate(
   
   5. 
   
   user_liked=Case(
   
   6. 
   
   When(Q(likes__user=self.request.user) & Q(
   
   


On Thursday, May 14, 2020 at 10:07:25 PM UTC-4, Motaz Hejaze wrote:
>
> Where does this exception happen ?
> In which file , which line ? 
>
> On Fri, 15 May 2020, 12:51 am Ahmed Khairy,  > wrote:
>
>> Hi all 
>>
>> I am adding a like/unlike button for Posts in a Listview, I am getting an 
>> error: 
>>
>> Exception Value:  Related Field got invalid lookup: value
>>
>> here is the Model:
>>
>> class Post(models.Model):
>> designer = models.ForeignKey(User, on_delete=models.CASCADE)
>> title = models.CharField(max_length=100)
>> likes = models.ManyToManyField(User, through="Like", 
>> related_name='liked')
>>
>> def __str__(self):
>> return self.title
>>
>> def get_absolute_url(self):
>> return reverse("score:post-detail", kwargs={'pk': self.pk})
>>
>> class Like(models.Model):
>> user = models.ForeignKey(User, on_delete=models.CASCADE)
>> post = models.ForeignKey(Post, on_delete=models.CASCADE)
>> value = models.CharField(choices=LIKE_CHOICES,
>>  default='Like', max_length=10)
>>
>>def toggle_value(self):
>>if self.value == "Like":
>>self.value = "Unlike"
>>else:
>>self.value = "Like"
>>
>> def __str__(self):
>> return str(self.post.pk)
>>
>> the view:
>>
>> def like_post(request):
>> user = request.user
>> if request.method == 'Post':
>> post_id = request.POST.get('post_id')
>> post_obj = Post.objects.get(id=post_id)
>> like, created = Like.objects.get_or_create(user=user, 
>> post_id=post_id)
>>
>> if not created:
>> like.toggle_value()
>> like.save()
>> return redirect('score:score')
>>
>> class PostListView(ListView):
>> model = Post
>> template_name = "score.html"
>> ordering = ['-date_posted']
>> context_object_name = 'posts'
>> queryset = Post.objects.filter(admin_approved=True)
>> paginate_by = 5
>>
>> def get_queryset(self, **kwargs):
>>queryset = super(PostListView, self).get_queryset(**kwargs):
>>return queryset.annotate(
>>total_liked=Count(
>> 'likes',
>> filter=Q(likes__value="Like")
>>).annotate(
>> user_liked=Case(
>> When(Q(likes__user=self.request.user) & 
>> Q(likes__value="Like"), then=Value(True)),
>> default=Value(False),
>> output_field = BooleanField()
>>)
>>)
>>
>> Here is the template
>>
>> {% for post in posts %}
>>  {{post.title}}
>>
>>
>>{% csrf_token %}
>>> style="font-style: inherit; font-variant: inherit; font-weight: inh
>>
>>

-- 
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/c0c11a1e-69c1-4b90-a608-d7691bd7d76c%40googlegroups.com.


Re: Exception Value: Related Field got invalid lookup: value

2020-05-14 Thread Motaz Hejaze
Where does this exception happen ?
In which file , which line ?

On Fri, 15 May 2020, 12:51 am Ahmed Khairy, 
wrote:

> Hi all
>
> I am adding a like/unlike button for Posts in a Listview, I am getting an
> error:
>
> Exception Value:  Related Field got invalid lookup: value
>
> here is the Model:
>
> class Post(models.Model):
> designer = models.ForeignKey(User, on_delete=models.CASCADE)
> title = models.CharField(max_length=100)
> likes = models.ManyToManyField(User, through="Like", related_name='liked')
>
> def __str__(self):
> return self.title
>
> def get_absolute_url(self):
> return reverse("score:post-detail", kwargs={'pk': self.pk})
>
> class Like(models.Model):
> user = models.ForeignKey(User, on_delete=models.CASCADE)
> post = models.ForeignKey(Post, on_delete=models.CASCADE)
> value = models.CharField(choices=LIKE_CHOICES,
>  default='Like', max_length=10)
>
>def toggle_value(self):
>if self.value == "Like":
>self.value = "Unlike"
>else:
>self.value = "Like"
>
> def __str__(self):
> return str(self.post.pk)
>
> the view:
>
> def like_post(request):
> user = request.user
> if request.method == 'Post':
> post_id = request.POST.get('post_id')
> post_obj = Post.objects.get(id=post_id)
> like, created = Like.objects.get_or_create(user=user, post_id=post_id)
>
> if not created:
> like.toggle_value()
> like.save()
> return redirect('score:score')
>
> class PostListView(ListView):
> model = Post
> template_name = "score.html"
> ordering = ['-date_posted']
> context_object_name = 'posts'
> queryset = Post.objects.filter(admin_approved=True)
> paginate_by = 5
>
> def get_queryset(self, **kwargs):
>queryset = super(PostListView, self).get_queryset(**kwargs):
>return queryset.annotate(
>total_liked=Count(
> 'likes',
> filter=Q(likes__value="Like")
>).annotate(
> user_liked=Case(
> When(Q(likes__user=self.request.user) & 
> Q(likes__value="Like"), then=Value(True)),
> default=Value(False),
> output_field = BooleanField()
>)
>)
>
> Here is the template
>
> {% for post in posts %}
>  {{post.title}}
>
>
>{% csrf_token %}
> style="font-style: inherit; font-variant: inherit; font-weight: inh
>
>

-- 
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-eXE7nXqQJhtAYbh2gGVyFnYpjBtjn5hYTsg2%2BBpG9VEg%40mail.gmail.com.


Re: How to clone or run your project on local machine by cloning/connecting to Linode Server. what are requirements need to be installed on your Machine.

2020-05-14 Thread chaitanya orakala
Yes, You are correct. It has nothing to do with the server when I cloned it
from Git. I did follow your Process but the Django app consists of multiple
settings files for Production, Development, and Test.

I configured my own settings file and try to run the command
Python manage.py runserver --settings=settings_sai

Error: ModuleNotFoundError: No module named 'settings_dev_sai'

This is my settings.py file
***
import socket

#import settings depending on the box we are on
HOST = socket.gethostname()
TPA_CODE = "Bridge"
TPA_NAME = "Bridge Benefits System"

#development
if HOST == "BITS-DP-LAPTOP":
from settings_dev import *
TPA_NAME = "ICBA Benefit Services Ltd."
TPA_CODE = 'ICBA'
#DFG bridge
elif HOST == "dfginternal":
from settings_dfg_ees import *
TPA_NAME = "Dehoney Financial Group"
TPA_CODE = 'DFG'
#test
elif HOST == "DFGTEST02":
from settings_staging import *
elif HOST == "icbaweb":
from settings_production_icba import *
TPA_NAME = "ICBA Benefit Services Ltd."
TPA_CODE = 'ICBA'
elif HOST == "meritweb":
from settings_production_merit import *
TPA_NAME = "Ontario Construction Industry Benefit Plan"
TPA_CODE = 'MERIT'
elif HOST == "dfgweb" :
from settings_production_dfg import *
TPA_NAME = "Dehoney Financial Group"
TPA_CODE = 'DFG'
elif HOST == "dev" or HOST == "j-ubu" :
from settings_dev_baikal import *
elif HOST == "jdev" :
from settings_dev_juliab import *
elif HOST == "DESKTOP-QU02FDK":
from settings_dev_sai import *
elif HOST == "johnstonesweb" :
from settings_production_johnstones import *
TPA_NAME = "Johnstone's Benefits"
TPA_CODE = 'JOHNSTONES'
elif HOST == "bridgedemo" :
from settings_demo import *
TPA_CODE = "Bridge"
TPA_NAME = "Bridge Benefits System"
else:
raise ImportError("This server's hostname [" + HOST + "] does not have
a proper expanded settings file. Please configure one.")

***
settings_dev_sai.py file

from settings_common import *

DEBUG = True
RUN_TYPE = RUN_DEV

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
#'NAME': 'bridge_icba',
'NAME': 'bridge_js',
#'NAME': 'bridge_dfg_internal',
#'NAME': 'bridge_dfg',
'HOST': 'localhost',
'USER': 'django',
'PASSWORD': 'bridge_user',
'PORT': '',
},
}

MEDIA_ROOT = 'C:/Users/DavidPiccione/Dropbox/Work -
Bridge/Projects/bridge/MEDIA/'
MEDIA_URL = '/media/'

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'bridgeautomaticmessen...@gmail.com'
EMAIL_HOST_PASSWORD = 'bridgeautomaticmessenger123'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'bridgeautomaticmessen...@gmail.com'


STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ("C:/Users/DavidPiccione/Dropbox/Work -
Bridge/Projects/bridge/static",)
STATIC_PATH = 'C:/Users/DavidPiccione/Dropbox/Work -
Bridge/Projects/bridge/static'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["C:/Users/DavidPiccione/Dropbox/Work -
Bridge/Projects/bridge/TEMPLATES",],
'APP_DIRS': False,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
'bridge.context_processors.global_settings',],
},
},
]


USE_ASSOCIATION_BANK_ACCOUNTS = True
***

Please help me with this...


On Thu, May 14, 2020 at 5:34 PM Julio Cojom 
wrote:

> It must have a requirements.txt , so run pip install -r requirements.txt.
>
> Next run all django stuff (manage.py makemigrations, manage.py migrate,
> manage.py runserver)
>
> if requirements.txt isnt in the git repo, you can do it running manage.py
> runserver and watching every error it throws and installing the missing
> packages or loggin in the server, making the requirements.txt and pushing
> to the repo.
>
> Dont think linode as a new thing, its just a server, like any others.
>
>
>
> El jue., 14 may. 2020 a las 13:28, chaitan ()
> escribió:
>
>> Hi every one,
>> I am hired as a Python/Django Developer. My company has deployed its *Django
>> application* into LINODE  Server. I have experience using the Heroku
>> server,
>> but Pretty much new to this *Linode server*, have no clue about this. I
>> want to run/Connect to project to that server to *run locally* on my
>> machine.
>>
>> I have access my GIT repo of project and cloned to my machine(windows),
>>
>> *What are the requirements needed to run

Exception Value: Related Field got invalid lookup: value

2020-05-14 Thread Ahmed Khairy
Hi all 

I am adding a like/unlike button for Posts in a Listview, I am getting an 
error: 

Exception Value:  Related Field got invalid lookup: value

here is the Model:

class Post(models.Model):
designer = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=100)
likes = models.ManyToManyField(User, through="Like", related_name='liked')

def __str__(self):
return self.title

def get_absolute_url(self):
return reverse("score:post-detail", kwargs={'pk': self.pk})

class Like(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
post = models.ForeignKey(Post, on_delete=models.CASCADE)
value = models.CharField(choices=LIKE_CHOICES,
 default='Like', max_length=10)

   def toggle_value(self):
   if self.value == "Like":
   self.value = "Unlike"
   else:
   self.value = "Like"

def __str__(self):
return str(self.post.pk)

the view:

def like_post(request):
user = request.user
if request.method == 'Post':
post_id = request.POST.get('post_id')
post_obj = Post.objects.get(id=post_id)
like, created = Like.objects.get_or_create(user=user, post_id=post_id)

if not created:
like.toggle_value()
like.save()
return redirect('score:score')

class PostListView(ListView):
model = Post
template_name = "score.html"
ordering = ['-date_posted']
context_object_name = 'posts'
queryset = Post.objects.filter(admin_approved=True)
paginate_by = 5

def get_queryset(self, **kwargs):
   queryset = super(PostListView, self).get_queryset(**kwargs):
   return queryset.annotate(
   total_liked=Count(
'likes',
filter=Q(likes__value="Like")
   ).annotate(
user_liked=Case(
When(Q(likes__user=self.request.user) & Q(likes__value="Like"), 
then=Value(True)),
default=Value(False),
output_field = BooleanField()
   )
   )

Here is the template

{% for post in posts %}
 {{post.title}}

   
   {% csrf_token %}
   
   {% if post.user_liked %}
Like 
   {% else %}
Unlike 

   {% endif %}
   
   {{post.total_liked}} Likes 
{% endfor %}

Here is the URL 

path('', PostListView.as_view(), name='score'),
path('like/', like_post, name='like_post'),


Thank you 

-- 
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/ea1852c9-2b9c-40c7-b6e7-67be69bbc1f7%40googlegroups.com.


Re: How to clone or run your project on local machine by cloning/connecting to Linode Server. what are requirements need to be installed on your Machine.

2020-05-14 Thread Julio Cojom
It must have a requirements.txt , so run pip install -r requirements.txt.

Next run all django stuff (manage.py makemigrations, manage.py migrate,
manage.py runserver)

if requirements.txt isnt in the git repo, you can do it running manage.py
runserver and watching every error it throws and installing the missing
packages or loggin in the server, making the requirements.txt and pushing
to the repo.

Dont think linode as a new thing, its just a server, like any others.



El jue., 14 may. 2020 a las 13:28, chaitan ()
escribió:

> Hi every one,
> I am hired as a Python/Django Developer. My company has deployed its *Django
> application* into LINODE  Server. I have experience using the Heroku
> server,
> but Pretty much new to this *Linode server*, have no clue about this. I
> want to run/Connect to project to that server to *run locally* on my
> machine.
>
> I have access my GIT repo of project and cloned to my machine(windows),
>
> *What are the requirements needed to run locally? What is the appropriate
> question to ask my Manager to get it done?*
>
> *Please share any links/process to it.*
>
> Thanks in Advance.
>
>
>
>
>
> --
> 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/4e73ca52-7221-4fb3-83fb-493e9160eaec%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/CAHRQUH%3DhwTP8q4%2B5%3D4ZS_yHGLc-D_VqUj%3D3KFCUvDRLt6driWA%40mail.gmail.com.


Re: TypeError: resolve() got an unexpected keyword argument 'strict' in Django

2020-05-14 Thread uday
Abhi,
Did you got any resolution for this issue. I did recent upgrade to Django 
3.0.6 and started getting the same issue.
My pathlib library is also upto date.

On Monday, April 13, 2020 at 4:28:57 AM UTC+5:30, Abhishek Pandey wrote:
>
> Hello Everyone!
>
> I am a new Django learner. I followed some tutorials to install django but 
> when i try to runserver an error message comes up. Whenever I hit this 
> command: python manage.py runserver
> the following error comes up.
>
> Watching for file changes with StatReloader
> Performing system checks...
>
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 401, in execute_from_command_line
> utility.execute()
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 395, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/base.py",
>  
> line 328, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 60, in execute
> super().execute(*args, **options)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/base.py",
>  
> line 369, in execute
> output = self.handle(*args, **options)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 95, in handle
> self.run(**options)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 102, in run
> autoreload.run_with_reloader(self.inner_run, **options)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 599, in run_with_reloader
> start_django(reloader, main_func, *args, **kwargs)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 584, in start_django
> reloader.run(django_main_thread)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 299, in run
> self.run_loop()
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 305, in run_loop
> next(ticker)
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 345, in tick
> for filepath, mtime in self.snapshot_files():
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 361, in snapshot_files
> for file in self.watched_files():
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 260, in watched_files
> yield from iter_all_python_module_files()
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 105, in iter_all_python_module_files
> return iter_modules_and_files(modules, frozenset(_error_files))
>   File 
> "/Users/Abhi/PycharmProjects/SearchProject/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 141, in iter_modules_and_files
> resolved_path = path.resolve(strict=True).absolute()
> TypeError: resolve() got an unexpected keyword argument 'strict'
>
>
>
> Can anyone help me out with this, please?
>
>

-- 
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/8f9d6e92-d645-4e49-9ea3-0ffce3f56ae3%40googlegroups.com.


How to clone or run your project on local machine by cloning/connecting to Linode Server. what are requirements need to be installed on your Machine.

2020-05-14 Thread chaitan
Hi every one,
I am hired as a Python/Django Developer. My company has deployed its *Django 
application* into LINODE  Server. I have experience using the Heroku 
server, 
but Pretty much new to this *Linode server*, have no clue about this. I 
want to run/Connect to project to that server to *run locally* on my 
machine.

I have access my GIT repo of project and cloned to my machine(windows), 

*What are the requirements needed to run locally? What is the appropriate 
question to ask my Manager to get it done?*

*Please share any links/process to it.*

Thanks in Advance.





-- 
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/4e73ca52-7221-4fb3-83fb-493e9160eaec%40googlegroups.com.


Re: Deploying Django Project on heroku

2020-05-14 Thread Sunday Iyanu Ajayi
Thank you. I will do that
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Thu, May 14, 2020 at 3:58 AM Akshat Zala  wrote:

> If possible, please downgrade the django version to django2.2 LTS and try
> again...
>
> --
> 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/536aaeb3-f6a7-4dcf-b856-927a79b3a08f%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/CAKYSAw2iqXV_FFDM6Ja0RRFkr0jjyEyJ_60_vkjUm2jc-pt%2B7g%40mail.gmail.com.


Re: how to save multiple checkbox values and checked status(true or false) in the django....

2020-05-14 Thread Kasper Laudrup



On 14/05/2020 14.42, frontend developer wrote:
thanks very much for your replyi want to how to store the check box 
value and checked state in the django..can help on this




So what have you tried so far and where are you facing issues?

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/c5eca03d-0346-b075-8f8e-14b4138e627f%40stacktrace.dk.


Re: Inserting data from a text file is not working for Postgres database

2020-05-14 Thread ABHIJIT PATKAR
Try to give complete path of file and try again
Thank you,
Abhijit

On Thu, 14 May, 2020, 10:27 AM Ram,  wrote:

>  Hi,
>
> We are trying to insert the data from a text file '
> *some_category_list.txt*'' into a table in Postgres database using the
> highlighted query in our functions.py
>
> file = open(str(a)+'_category_list.txt', 'r')
>> file_content = file.read()
>> print(file_content)
>> file.close()
>> from django.db import connection
>> cursor = connection.cursor()
>> *query = "COPY pages_rim_ls_categories FROM '{0}_category_list.txt' WITH
>> DELIMITER AS '|'".format(str(a)) *
>> cursor.execute(query)
>>
>>
> and we are getting this error
>
> django.db.utils.OperationalError: could not open file
>> "some_category_list.txt" for reading: No such file or directory
>>
>
>
>> HINT: COPY FROM instructs the PostgreSQL server process to read a file.
>> You may want a client-side facility such as psql's \copy.
>>
>
> Note: We used below query in the past using MySQL and it worked fine with
> that.
>
> query = "LOAD DATA LOCAL INFILE '*some_category_list.txt'* INTO TABLE
>> pages_rim_ls_categories FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' "
>>
>
> We are wondering what we are missing. Could someone help here to verify
> this?
>
> Best regards
> ~Ram
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2P8Oy-gOUWC54imqcNvdmHw3LuC%3DuKkR5Xzq_w3HXjjA%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/CA%2BOx31O8zOzhoyXyVoncDVSB5nWZU49%3DFgT49htrYhhwuWd19w%40mail.gmail.com.


Re: CSS with Django forms

2020-05-14 Thread Anubhav Madhav
Thankyou Clive!! I know I can use CSS like that, but if I do that the 
problem I'll face is that the 'form' or the 'input' tags or 'submit' 
button, which are rendered using django forms, cannot be modified using CSS 
in this way. Is there any other way to fix it?

On Wednesday, 13 May 2020 18:58:08 UTC+5:30, Clive Bruton wrote:
>
>
> On 12 May 2020, at 22:41, Anubhav Madhav wrote: 
>
> > Is there any way to display the forms with my HTML CSS files. 
>
> Use {% include %} (https://docs.djangoproject.com/en/3.0/ref/ 
> templates/builtins/#include) in your HTML template files for an   
> embedded style sheet, or just use a link in the head of your template   
> to serve the .css from the "static" folder (or other remote server   
> location). 
>
>
> -- 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/d9650e11-31a1-44ff-a4c4-2a59e7ac27cf%40googlegroups.com.


Re: CSS with Django forms

2020-05-14 Thread Anubhav Madhav
Thankyou Kasper :)

On Wednesday, 13 May 2020 19:02:46 UTC+5:30, Kasper Laudrup wrote:
>
>
>
> On 13/05/2020 06.17, Bighnesh Pradhan wrote: 
> > you can use javascript it is good 
> > 
>
> Oh yes, we all love javascript: 
>
> https://www.destroyallsoftware.com/talks/wat 
>
> :-) 
>
> Seriously though, javascript has nothing to do with using static CSS in 
> django templates. 
>

-- 
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/8f99fe0e-2408-4433-b8f4-8500523cbbac%40googlegroups.com.


Re: CSS with Django forms

2020-05-14 Thread Anubhav Madhav
Thankyou Bighnesh

On Wednesday, 13 May 2020 18:57:36 UTC+5:30, Bighnesh Pradhan wrote:
>
> you can use javascript it is good
>
> On Wed, May 13, 2020 at 3:13 AM Anubhav Madhav  > wrote:
>
>> My problem is, that I've made a beautiful 'Sign Up' and 'Login' Page 
>> using HTML and CSS. Later on, in my project, I had to use 'forms' for 
>> registration and login.
>> Is there any way to display the forms with my HTML CSS files.
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d53c8101-9243-47b2-9ca5-a727888034ca%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/1c9e7486-691d-48fd-8b10-2335bec6be05%40googlegroups.com.


Re: Django 3.1 alpha 1 released

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

Django 3.1 alpha 1 works for me and my project, I just had to change some
imports. I ran all the unit tests and they all passed.

Uri.

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


On Thu, May 14, 2020 at 12:44 PM Mariusz Felisiak <
felisiak.mari...@gmail.com> wrote:

> Details are available on the Django project weblog:
>
>
> https://www.djangoproject.com/weblog/2020/may/14/django-31-alpha-1-released/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/3c9e3956-91e6-3549-f500-f0ff5f3b73b9%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/CABD5YeFgb4D%2BwLdOHqSmOJiiTvN81_j1rOuiwdr5C0RJ%3Dwbjug%40mail.gmail.com.


Re: Django Model

2020-05-14 Thread muazzem_ hossain
Thank you for help

On Thu, May 14, 2020 at 7:23 PM Derek  wrote:

> >>> from django.apps import apps
> >>> apps.all_models['app_name']
>
> So if your app is called, for example, products, then:
>
> >>> apps.all_models['products']
>
> Will create a dictionary with all the model classes from that app.
>
> On Thursday, 14 May 2020 14:03:40 UTC+2, muazzem_ hossain wrote:
>>
>> how to get django all app model.
>>
> --
> 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/2406a55d-8d5a-406d-ba61-aee086a11352%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/CAOyg_oN%2BSOQm6hEsOtcosVoNu4B7rOHCH72XYRp59AbUUxxwzg%40mail.gmail.com.


Re: password reset pages are not showing customizing html file

2020-05-14 Thread Ali Ahammad
hello guys 

i have tried email_template_name = 'registration/password_reset_email.html', 
success_url = reverse_lazy('registration:password_reset_done') but still no 
luck. i tried to edit template_name='accounts/reset_password.html, seems 
like django is reaching out to this hml file. but when i delete all the 
code or kept all the code inside reset_password.html, it won't have any 
effect. seems like whtever i write it isn't rendering to base.html. what 
should be the effective solution?  

please help

On Wednesday, May 13, 2020 at 6:45:02 PM UTC+1, Ali Ahammad wrote:
>
> hello everyone
>
> i am trying to make a blog where i am trying to customize password reset 
> forms. 
> here is my bloggapp/urls.py:
> from django.contrib import admin
> from django.urls import path, include 
> from django.views.generic.base import TemplateView 
> from django.contrib.auth import views as auth_views
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('accounts/', include('accounts.urls')), 
> #path('users/', include('django.contrib.auth.urls')), 
> path('accounts/login/', auth_views.LoginView.as_view(template_name=
> 'registration/login.html'), name='login'),
> path('accounts/logout/', auth_views.LogoutView.as_view(template_name=
> 'logout.html'), name='logout'),
> path('', include('blog.urls')),
> path('password-reset/', 
>  auth_views.PasswordResetView.as_view
>  (template_name='registration/password_reset.html'), 
>  name='password_reset'),
> path('password-reset/done/', 
>  auth_views.PasswordResetDoneView.as_view
>  (template_name='registration/password_reset_done.html'), 
>  name='password_reset_done'),
> path('password-reset-confirm///',
>  auth_views.PasswordResetConfirmView.as_view(
>  template_name='registration/password_reset_confirm.html'
>  ),
>  name='password_reset_confirm'),
>  path('password-reset-complete/',
>  auth_views.PasswordResetCompleteView.as_view(
>  template_name='registration/password_reset_complete.html'
>  ),
>  name='password_reset_complete'),
>
> ]
>
> http://localhost:8000/password-reset/ this page is showing the html form 
> i have wrote in registration/password_reset.html directory which is under 
> accounts app. in the accounts app there is templates folder and in this 
> folder i have kept base.html. in the same folder i have created 
> registration folder where i kept login.html and password_reset.html.
>
> i have set up my email smtp in sendgrid and it is working. besides 
> registration/login.html,templates/signup.html files are working.
> i am including my base.html file also:
>
> 
> 
>
> 
> 
> 
> 
> 
> https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/\
> bootstrap.min.css" integrity=
> "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81i\
> uXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
> {% block title %}Newspaper App{% endblock title %}
> 
>
> 
> 
> Newspaper<
> button class="navbar-toggler" type="button"
> data-toggle="collapse" data-target="#navbarCollapse" 
> aria-controls="navbarCollapse" aria-expanded="false"
> aria-label="Toggle navigation">
> 
> 
> 
> {% if user.is_authenticated %}
> 
> 
>  "userMenu" data-toggle="dropdown"
> aria-haspopup="true" aria-expanded="false">
> {{ user.username }}
> 
>  aria-labelledby="userMenu">
>  "{% url 'password_reset'%}">Change password
> 
>  >
> Log Out
> 
> 
> 
> {% else %}
> 
>  "btn btn-outline-secondary">
> Log In
> 
> Sign up
> 
> {% endif %}
> 
> 
> 
> {% block content %}
> {% endblock content %}
> 
> 
> 
> https://code.jquery.com/jquery-3.3.1.slim.min.js"; 
> integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4\
> YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
> https://cdnjs.cloudflare.com/ajax/libs/popper.js/\
> 1.14.3/
> umd/popper.min.js" integrity=
> "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbB\
> JiSnjAK/
> l8WvCWPIPm49" crossorigin="anonymous">
> https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/\
> js/bootstrap.min.js" integrity=
> "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ\
> 6OW/JmZQ5stwEULTy" crossorigin="anonymous">
> 
>
> 
>
> and templates/home.html also:
> {% extends 'base.html' %}
> {% block title %}Home{% endblock title %}
> {% block content %}
> {% if user.is_authenticated %}
> Hi {{ user.username }}!
> Log Out
> {% else %}
> You are not logge

Re: Django Model

2020-05-14 Thread Derek
>>> from django.apps import apps
>>> apps.all_models['app_name']

So if your app is called, for example, products, then:

>>> apps.all_models['products']

Will create a dictionary with all the model classes from that app.

On Thursday, 14 May 2020 14:03:40 UTC+2, muazzem_ hossain wrote:
>
> how to get django all app model.
>

-- 
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/2406a55d-8d5a-406d-ba61-aee086a11352%40googlegroups.com.


Re: Media files and download url

2020-05-14 Thread Parampal Singh
More details please 😊

On Tue, May 12, 2020, 12:52 AM Riska Kurniyanto Abdullah <
alternative@gmail.com> wrote:

> Amazon S3 have simple solution for that topic
>
>
> On Tue, May 12, 2020 at 1:27 AM Parampal Singh 
> wrote:
>
>> Access media vedio files only when user logged in
>>
>> Temporary file download url every time change
>>
>>
>> Any suggestions on these topics
>>
>> --
>> 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/e3df42b1-4dc8-478f-a25f-3315451f0852%40googlegroups.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/ilYjagGe-UY/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/CAG7yD2%2BWYKor2k8KRuq5peg1c3rPxRzpn6hoD4Ji8dfxhDi_Lw%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/CANYMdQLZSsNSLuTyXyTgakQiE0w59ojbfygxKSbBxTXkb_L7rw%40mail.gmail.com.


Re: how to save multiple checkbox values and checked status(true or false) in the django....

2020-05-14 Thread frontend developer
thanks very much for your replyi want to how to store the check box 
value and checked state in the django..can help on this

On Thursday, May 14, 2020 at 4:58:37 PM UTC+5:30, Kasper Laudrup wrote:
>
> On 14/05/2020 03.42, frontend developer wrote: 
> > Hello,  i am beginner to django, i am sending values and checked status 
> > from the front end using checkboxesnow i do not no how to write 
> > frame work in the django, can i get any help on these 
> > 
>
> Start by completing the official Django tutorial: 
>
> https://docs.djangoproject.com/en/3.0/intro/tutorial01/ 
>
> That will guide you through all the basics required for what you need to 
> do. 
>
> 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/eef994ca-2df1-4767-8be4-0fe6acc1b6f8%40googlegroups.com.


Django Model

2020-05-14 Thread muazzem_ hossain
how to get django all app model.

-- 
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/ebc4c695-1a73-4fd1-a761-98bda8b2e30b%40googlegroups.com.


Issue with Heroku Getting Started

2020-05-14 Thread J Maryott
Wondering if anyone may be able to shed some light on this...I've cloned 
the latest dev. version of Django from Git, and though I'm a bit of a 
newbie here, and this might sound totally dumb to the professionals (I'm 
unsure), I also tried pip install django.utilsas a last ditch 
effort. It seemed to download a package successfully, but still I'm 
receiving the same error.

I've made it about halfway though the "Getting Started with Python" 
tutorial on the Heroku Dev Center (
https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally),
 
and I get the following error when attempting to run collectstatic:


python manage.py collectstatic

Traceback (most recent call last):
  File "manage.py", line 8, in 
from django.core.management import execute_from_command_line
  File 
"C:\Users\jakem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\__init__.py",
 line 1, in 
from django.utils.version import get_version
ModuleNotFoundError: No module named 'django.utils'

-- 
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/1be60359-eb10-4def-90dc-762d1315e66a%40googlegroups.com.


Re: how to save multiple checkbox values and checked status(true or false) in the django....

2020-05-14 Thread Kasper Laudrup

On 14/05/2020 03.42, frontend developer wrote:
Hello,  i am beginner to django, i am sending values and checked status 
from the front end using checkboxesnow i do not no how to write 
frame work in the django, can i get any help on these




Start by completing the official Django tutorial:

https://docs.djangoproject.com/en/3.0/intro/tutorial01/

That will guide you through all the basics required for what you need to do.

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/712aeaa2-2cba-7d9a-f7f3-cd9404047aee%40stacktrace.dk.


Re: Django 3.1 alpha 1 released

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

I found out that I can use:
pip install --upgrade --pre django

Thanks,
Uri.
אורי
u...@speedy.net


‪On Thu, May 14, 2020 at 1:49 PM ‫אורי‬‎  wrote:‬

> Hi,
>
> Is it possible to install Django 3.1 alpha 1 from pip and how? I want to
> test it locally and on Travis CI and the easiest way to install it for me
> is with pip.
>
> Thanks,
> Uri.
>
> אורי
> u...@speedy.net
>
>
> On Thu, May 14, 2020 at 12:44 PM Mariusz Felisiak <
> felisiak.mari...@gmail.com> wrote:
>
>> Details are available on the Django project weblog:
>>
>>
>> https://www.djangoproject.com/weblog/2020/may/14/django-31-alpha-1-released/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers  (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/3c9e3956-91e6-3549-f500-f0ff5f3b73b9%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/CABD5YeG9RcktqznY0NubkEXfFEnm%3DYjM0c%2Bmea8JW7wF-YALjw%40mail.gmail.com.


Re: Django 3.1 alpha 1 released

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

Is it possible to install Django 3.1 alpha 1 from pip and how? I want to
test it locally and on Travis CI and the easiest way to install it for me
is with pip.

Thanks,
Uri.

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


On Thu, May 14, 2020 at 12:44 PM Mariusz Felisiak <
felisiak.mari...@gmail.com> wrote:

> Details are available on the Django project weblog:
>
>
> https://www.djangoproject.com/weblog/2020/may/14/django-31-alpha-1-released/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/3c9e3956-91e6-3549-f500-f0ff5f3b73b9%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/CABD5YeHsbi0AmiW%2BL8uHVURS1MhYtO4vRKe-0%2B8G75Dc4yyX1g%40mail.gmail.com.


Django 3.1 alpha 1 released

2020-05-14 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2020/may/14/django-31-alpha-1-released/

--
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/3c9e3956-91e6-3549-f500-f0ff5f3b73b9%40gmail.com.