Missing staticfiles manifest entry on heroku app, runs fine locally

2020-06-25 Thread James
Hi everyone,

I'm getting server error 500 when I deploy my app to heroku. The logs show 
an issue with staticfiles, even though I'm serving static and media from an 
S3 bucket:

ValueError: Missing staticfiles manifest entry for 'images/favicon.ico'

What's odd is that run I run locally, even with DEBUG=False, the app runs 
fine and I verified that the images are loading from the S3 bucket (both 
media and static). However, for some reason heroku is unable to load from 
S3.

Settings.py:

import os
import storages
import django_heroku


# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))




# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '***'


# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = (os.environ.get('DEBUG_VALUE') == 'True')
#DEBUG = False


ALLOWED_HOSTS = ['localhost', 'testapp.herokuapp.com', 'testapp.tv']




# Application definition
# NOTE: django_cleanup should be placed last in INSTALLED_APPS.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'taggit',
'storages',
'post.apps.PostConfig',
'ckeditor',
'sorl.thumbnail',
'django_cleanup.apps.CleanupConfig',
]


MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]


ROOT_URLCONF = 'testapp.urls'


TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]


WSGI_APPLICATION = 'testapp.wsgi.application'




# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}




# Password validation
# 
https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators


AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]




# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/


LANGUAGE_CODE = 'en-us'


TIME_ZONE = 'UTC'


USE_I18N = True


USE_L10N = True


USE_TZ = True




# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/


# STATIC_URL = '/static/'


# # Add these new lines
# STATICFILES_DIRS = (
# os.path.join(BASE_DIR, 'static'),
# )


# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')


# Form messages
from django.contrib.messages import constants as messages


MESSAGE_TAGS= {
messages.DEBUG: 'alert-info',
messages.INFO: 'alert-info',
messages.SUCCESS: 'alert-success',
messages.WARNING: 'alert-warning',
messages.ERROR: 'alert-danger',
}


# Memcached settings
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}


# Amazon S3 settings and variables
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = 'testapp-files'


AWS_S3_FILE_OVERWRITE = False
AWS_DEFAULT_ACL = None


AWS_LOCATION = 'static'
AWS_S3_CUSTOM_DOMAIN='%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_S3_OBJECT_PARAMETERS = {
 'CacheControl': 'max-age=86400',
}


DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
#DEFAULT_FILE_STORAGE = 'testapp.storage_backends.MediaStorage'
STATICFILES_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
] 
STATIC_URL='https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
STATICFILES_FINDERS = (   
'django.contrib.staticfiles.finders.FileSystemFinder',

Re: Django queryset filtering

2020-06-25 Thread Oleg Kishenkov
Hello, use a filtering chain, a refined queryset is itself a queryset so
you can filter it further. Also, Django has extensive lookup support in its
filtering methods. Let's assume LicenseIssue is related to Business as many
to one (it is probably the case):

class Business(models.Model):
name = models.CharField(max_length=15)

class LicenseIssue(models.Model):
expiry_date = model.DateField(null=False)
business = model.ForeignKey(Business, on_delete=models.CASCADE)

First you filter out expired licenses, second you exclude the licences
which belong to businesses that have valid licences.

qs =
LicenceIssue.objects.filter(expiry_date__lte=datetime.now()).exclude(business__license__expiry_date__gte='2020-01-01')

I have to point out that here license in business__license__expiry_date__gte
is an automatically generated related_query_name.

Oleg

чт, 25 июн. 2020 г. в 01:25, mtp...@gmail.com :

> I have a queryset that returns all the expired licenses objects as shown
> below.
>
>
> *qs = 
> LicenseIssue.objects.filter(expiry_date__lte=TODAY).order_by('-expiry_date')*
>
>
> Here is my situation:
> There exists multiple issued licenses of different businesses for year
> 2020 and their  previous issued licenses for the for year 2019, 2018 and so
> on. The above queryset results to listing all expired licenses though I'd
> like to make it possible if there exists issued licenses for year 2020
> their previous issued licenses should not appear in the expired licenses
> queryset. Please advise on this.
>
> --
> 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/7d5ed088-c21b-4bd3-aba3-0f61c05efa50n%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/CAFAt%3DiwNZW_TM4J5oQ-5RjFb6fGok-n%2B1a2YjV_WgK7H8PX-ow%40mail.gmail.com.


Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
Nice solution. Thanks!

On Thursday, June 25, 2020 at 5:49:23 PM UTC-4, Dan Madere wrote:
>
> I don't know of a way to configure the admin do that, but one solution 
> would be to use signals to notice when one-way records are created, then 
> automatically create the record for reverse relationship. We need to notice 
> when records are deleted as well. This approach would allow showing one 
> inline that shows the combined results. I was able to get it working with 
> this: https://gist.github.com/dgmdan/e7888a73c14446dccd7ad9aaf5055b10
> Hope this helps!
>

-- 
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/d9cd8467-74c5-4915-a452-15f4fc2d03bfo%40googlegroups.com.


Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Dan Madere
I don't know of a way to configure the admin do that, but one solution 
would be to use signals to notice when one-way records are created, then 
automatically create the record for reverse relationship. We need to notice 
when records are deleted as well. This approach would allow showing one 
inline that shows the combined results. I was able to get it working with 
this: https://gist.github.com/dgmdan/e7888a73c14446dccd7ad9aaf5055b10
Hope this helps!

On Thursday, June 25, 2020 at 1:53:45 PM UTC-4 jes...@gmail.com wrote:

> After reviewing the tests, I think I now understand what is going on.
>
> Basically, for symmetric ManyToManyField, Django creates entries for both 
> directions automatically if the correct interface is used. From the test 
> models:
>
> class PersonSelfRefM2M(models.Model):
> name = models.CharField(max_length=5)
> sym_friends = models.ManyToManyField('self', 
> through='SymmetricalFriendship', symmetrical=True)
>
>
> class SymmetricalFriendship(models.Model):
> first = models.ForeignKey(PersonSelfRefM2M, models.CASCADE)
> second = models.ForeignKey(PersonSelfRefM2M, models.CASCADE, 
> related_name='+')
> date_friended = models.DateField()
>
>
> And the tests:
>
> def test_self_referential_symmetrical(self):
> tony = PersonSelfRefM2M.objects.create(name='Tony')
> chris = PersonSelfRefM2M.objects.create(name='Chris')
> SymmetricalFriendship.objects.create(
> first=tony, second=chris, date_friended=date.today(),
> )
> self.assertSequenceEqual(tony.sym_friends.all(), [chris])
> # Manually created symmetrical m2m relation doesn't add mirror entry
> # automatically.
> self.assertSequenceEqual(chris.sym_friends.all(), [])
> SymmetricalFriendship.objects.create(
> first=chris, second=tony, date_friended=date.today()
> )
> self.assertSequenceEqual(chris.sym_friends.all(), [tony])
>
> def test_add_on_symmetrical_m2m_with_intermediate_model(self):
> tony = PersonSelfRefM2M.objects.create(name='Tony')
> chris = PersonSelfRefM2M.objects.create(name='Chris')
> date_friended = date(2017, 1, 3)
> tony.sym_friends.add(chris, through_defaults={'date_friended': 
> date_friended})
> self.assertSequenceEqual(tony.sym_friends.all(), [chris])
> self.assertSequenceEqual(chris.sym_friends.all(), [tony])
> friendship = tony.symmetricalfriendship_set.get()
> self.assertEqual(friendship.date_friended, date_friended)
>
>
> So the tests show that the add() method needs to be used to create both 
> sides of the relationship. I assume that the Admin page does not use the 
> add method, but creates the intermediate entries which would require both 
> the be added for each entry.
>
> Is it possible to configure the Admin models to use add() or to create 
> both directions automatically?
>
> Thanks!
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b8e0927d-6079-4a0a-91db-044d6f393998n%40googlegroups.com.


Re: Is there a package that enables one Django project to authenticate via a second Django project?

2020-06-25 Thread Dave R
Is REMOTE_USER a technology that's still used?  Aside from the one page of 
documentation, I don't see a lot of other references to it on Stack 
Overflow, etc.

In my implementation, the client authenticates to the server, pulls the 
latest-and-greatest user data, then saves it on the client database.

Philosophically, I guess it's a personal preference.  But, as a startup 
person, I tend to build a lot of throwaway apps that I don't want 
cluttering up the core tried-and-tested apps.

On Thursday, June 25, 2020 at 3:55:40 PM UTC-4 andrea...@hypercode.se wrote:

> First of all - why separate the django apps into various projects? That 
> seems a bit strange because you are depending on one user account and one 
> database? There isn't really any benefit of doing it like that - why not 
> use a single django project?
>
> But on the other hand - if you want to continue doing it like that - what 
> I would do is setup a "user" project - that only handles the users. Then 
> you can use the remote user functionality of django in the other projects. 
> That way you have the user object centralized and all of the projects can 
> use the user interface from the remote user.
>
> https://docs.djangoproject.com/en/3.0/howto/auth-remote-user/
>
> The reason I wouldn't use open id connect is because you still need a 
> local user object for each project in that case. 
>
> Regards,
>
> Andréas
>
>
> Den tors 25 juni 2020 kl 21:26 skrev Dave R :
>
>> I keep running into this problem and started working on a custom 
>> solution... but before I spend hours on this, I want to confirm that such a 
>> package/solution doesn't already exist.
>>
>> I was working on a large project last year that involved a single set of 
>> users and many small applications.  I made each application a Django app 
>> and had them all tied together in one database.  There was only one 
>> database dependency between the applications: the User table.
>>
>> This became almost impossible to maintain for  multiple reasons:
>> * I had two apps that required different values in settings.py
>> * The test suite took forever to run
>> * One of the apps was developed originally using Postgres and I had to 
>> spend hours hacking through code getting it to work with MySQL
>> * I had to share my entire code base to employ freelancers
>> * I had to deprecate one of the apps and this became a project in itself 
>> (i.e., remove references in settings.py, dropping database tables, etc.)
>>
>> Next time I'm in this situation, I'd like to develop each application as 
>> a separate Django project and have them authenticate (via OpenID Connect) 
>> to a project dedicated to this (e.g., accounts.mysite.com).
>>
>> Has anyone seen an out-of-the-box solution for this?  The question is 
>> very open-ended.
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0050a73c-fc46-449b-b087-a9f99508fadeo%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/30afa521-a35d-4ea3-b8d8-ec8cc3f297acn%40googlegroups.com.


Starving queue with django-celery and rabbitmq

2020-06-25 Thread Rogerio Carrasqueira
Hello guys!

I think it’s kind of off-topic, because it’s basically I think more
from RabbitMQ than from Django itself, but I believe someone has
already may have gone through with a similar situation.

I have a Django application that runs with celery 3.1 and rabbitmq
3.8.2, It uses rabbitmq to distribute messages among a series of
workers who do several tasks.

It happens that at on a given moment when a quantity of tasks enters
very large in a given queue, it seems to me that that queue wants to
take all workers for itself. It is as if this task gained an absurd
priority in the system and the celery determined that this queue got
all the attention in the world and the workers worked just for it.

Faced with this scenario, absurd situations start: which I have a
worker who works in queue1, a worker b who works in queue 2, and I
have configured in the celery routes task x should be allocated in the
queue for worker b to execute. Entering an absurd amount of messages
in queue 1, worker a and b starts to working only at queue1, and the
queue2 is put aside. Only when giving an execution error of worker b,
the task that was in queue 1 is allocated in queue 2, occurring hell
in the system, leaving a mass about the organization of queues,
causing a series of bottlenecks in the system.

So, I ask friends for a light and put it down as I am configuring my
celery settings:

BROKER_TRANSPORT_OPTIONS = {}

CELERY_IMPORTS = ("core.app1.tasks", "core.app2.tasks")
CELERYD_TASK_TIME_LIMIT = 7200

CELERY_ACKS_LATE = True
CELERYD_PREFETCH_MULTIPLIER = 1
#CELERYD_MAX_TASKS_PER_CHILD = 1

CELERY_TIMEZONE = 'America/Sao_Paulo'
CELERY_ENABLE_UTC = True

CELERYBEAT_SCHEDULE = {
'task1': {
'task': 'tasks.task1',
'schedule': crontab(minute='*/30'),
},
'task2': {
'task': 'tasks.task2',
'schedule': crontab(minute='*/30'),
},
}

CELERY_RESULT_BACKEND =
"redis://server-1.klglqr.ng.0001.use2.cache.amazonaws.com:6379/1"
CELERYBEAT_SCHEDULER = 'redbeat.RedBeatScheduler'
CELERYBEAT_MAX_LOOP_INTERVAL = 5

CELERY_DEFAULT_QUEUE = 'production-celery'
CELERY_SEND_TASK_ERROR_EMAILS = False

CELERY_ROUTES = {

'tasks.task_1':  {'queue': 'queue1'},
'tasks.task_2':{'queue': 'queue2},

}

Supervisor settings:

[program:app_core_production_celeryd_worker_a]

command=/usr/bin/python manage.py celery worker -n worker_a%%h -l INFO
-c 30  -Q fila1 -O fair --without-heartbeat --without-mingle
--without-gossip --autoreload --settings=core.settings.production
directory=/home/user/production/web_app/app
user=user
numprocs=1
stdout_logfile=/home/user/production/logs/celeryd_worker_a.log
stderr_logfile=/home/user/production/logs/celeryd_worker_a.log
autostart=true
autorestart=true
startsecs=10
stdout_logfile_maxbytes=5MB

[program:app_core_production_celeryd_worker_b]

command=/usr/bin/python manage.py celery worker -n worker_b%%h -l INFO
-c 30  -Q fila2 -O fair --without-heartbeat --without-mingle
--without-gossip --autoreload --settings=core.settings.production
directory=/home/user/production/web_app/app
user=user
numprocs=1
stdout_logfile=/home/user/production/logs/celeryd_worker_b.log
stderr_logfile=/home/user/production/logs/celeryd_worker_b.log
autostart=true
autorestart=true
startsecs=10
stdout_logfile_maxbytes=5MB

Thanks so much for your help!

Rogério Carrasqueira

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


Re: Is there a package that enables one Django project to authenticate via a second Django project?

2020-06-25 Thread Andréas Kühne
First of all - why separate the django apps into various projects? That
seems a bit strange because you are depending on one user account and one
database? There isn't really any benefit of doing it like that - why not
use a single django project?

But on the other hand - if you want to continue doing it like that - what I
would do is setup a "user" project - that only handles the users. Then you
can use the remote user functionality of django in the other projects. That
way you have the user object centralized and all of the projects can use
the user interface from the remote user.

https://docs.djangoproject.com/en/3.0/howto/auth-remote-user/

The reason I wouldn't use open id connect is because you still need a local
user object for each project in that case.

Regards,

Andréas


Den tors 25 juni 2020 kl 21:26 skrev Dave R :

> I keep running into this problem and started working on a custom
> solution... but before I spend hours on this, I want to confirm that such a
> package/solution doesn't already exist.
>
> I was working on a large project last year that involved a single set of
> users and many small applications.  I made each application a Django app
> and had them all tied together in one database.  There was only one
> database dependency between the applications: the User table.
>
> This became almost impossible to maintain for  multiple reasons:
> * I had two apps that required different values in settings.py
> * The test suite took forever to run
> * One of the apps was developed originally using Postgres and I had to
> spend hours hacking through code getting it to work with MySQL
> * I had to share my entire code base to employ freelancers
> * I had to deprecate one of the apps and this became a project in itself
> (i.e., remove references in settings.py, dropping database tables, etc.)
>
> Next time I'm in this situation, I'd like to develop each application as a
> separate Django project and have them authenticate (via OpenID Connect) to
> a project dedicated to this (e.g., accounts.mysite.com).
>
> Has anyone seen an out-of-the-box solution for this?  The question is very
> open-ended.
>
> --
> 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/0050a73c-fc46-449b-b087-a9f99508fadeo%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/CAK4qSCckHVc_Uk0nw25Dk2nXCvfuOnaf1dfxQO9kD1PqMu_P%3Dg%40mail.gmail.com.


Re: Project Collaboration Team

2020-06-25 Thread Chuck
 interested

On Thursday, June 25, 2020, 11:43:02 AM PDT, Hamza Mirchi 
 wrote:  
 
 interested

On Tuesday, June 23, 2020 at 8:20:37 AM UTC-4, Ali Murtuza wrote:
I am intrested 
On Tue, 23 Jun 2020 at 9:14 AM, Shubhanshu Arya  wrote:

Hello Everyone, I want to make a team in which we will make some very good 
level projects together. These projects will be very helpful in our interview 
as well. Must have prior knowledge about Django/Python. We will do daily 
meetings and discuss our project and we will use Github to team collaborations 
. If someone is interested to join this team please email me on 
shubhans...@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...@ googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/ 
msgid/django-users/53b14968- ae6f-428a-be58-5edd290f2487o% 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/8eec9a75-e76d-4899-93ab-9672645befcfo%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/595686038.2634009.1593110843432%40mail.yahoo.com.


Is there a package that enables one Django project to authenticate via a second Django project?

2020-06-25 Thread Dave R
I keep running into this problem and started working on a custom 
solution... but before I spend hours on this, I want to confirm that such a 
package/solution doesn't already exist.

I was working on a large project last year that involved a single set of 
users and many small applications.  I made each application a Django app 
and had them all tied together in one database.  There was only one 
database dependency between the applications: the User table.

This became almost impossible to maintain for  multiple reasons:
* I had two apps that required different values in settings.py
* The test suite took forever to run
* One of the apps was developed originally using Postgres and I had to 
spend hours hacking through code getting it to work with MySQL
* I had to share my entire code base to employ freelancers
* I had to deprecate one of the apps and this became a project in itself 
(i.e., remove references in settings.py, dropping database tables, etc.)

Next time I'm in this situation, I'd like to develop each application as a 
separate Django project and have them authenticate (via OpenID Connect) to 
a project dedicated to this (e.g., accounts.mysite.com).

Has anyone seen an out-of-the-box solution for this?  The question is very 
open-ended.

-- 
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/0050a73c-fc46-449b-b087-a9f99508fadeo%40googlegroups.com.


Re: How Can i integerate 2checkout with django / python3

2020-06-25 Thread Ogunsanya Opeyemi
You can do that by creating your view, url path and templates.

On Thursday, June 25, 2020, Hamza Mirchi  wrote:

> How Can i integerate 2checkout with django / python3
>
> --
> 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/760c0d3b-2ddd-464c-8446-ac7a5630e6c0o%
> 40googlegroups.com
> 
> .
>


-- 
OGUNSANYA OPEYEMI

-- 
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/CABJxPrGcQAH7-w%2BSq00rZy-XB7RzYobTAC2%2Bryn8zBD%2B9rMoRQ%40mail.gmail.com.


Re: Project Collaboration Team

2020-06-25 Thread Hamza Mirchi
interested

On Tuesday, June 23, 2020 at 8:20:37 AM UTC-4, Ali Murtuza wrote:
>
> I am intrested 
>
> On Tue, 23 Jun 2020 at 9:14 AM, Shubhanshu Arya  > wrote:
>
>> Hello Everyone, 
>> I want to make a team in which we will make some very good level projects 
>> together. These projects will be very helpful in our interview as well. 
>> Must have prior knowledge about Django/Python. We will do daily meetings 
>> and discuss our project and we will use Github to team collaborations . If 
>> someone is interested to join this team please email me on 
>> shubhans...@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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/53b14968-ae6f-428a-be58-5edd290f2487o%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/8eec9a75-e76d-4899-93ab-9672645befcfo%40googlegroups.com.


How Can i integerate 2checkout with django / python3

2020-06-25 Thread Hamza Mirchi
How Can i integerate 2checkout with django / python3

-- 
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/760c0d3b-2ddd-464c-8446-ac7a5630e6c0o%40googlegroups.com.


Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
After reviewing the tests, I think I now understand what is going on.

Basically, for symmetric ManyToManyField, Django creates entries for both 
directions automatically if the correct interface is used. From the test 
models:

class PersonSelfRefM2M(models.Model):
name = models.CharField(max_length=5)
sym_friends = models.ManyToManyField('self', 
through='SymmetricalFriendship', symmetrical=True)


class SymmetricalFriendship(models.Model):
first = models.ForeignKey(PersonSelfRefM2M, models.CASCADE)
second = models.ForeignKey(PersonSelfRefM2M, models.CASCADE, 
related_name='+')
date_friended = models.DateField()


And the tests:

def test_self_referential_symmetrical(self):
tony = PersonSelfRefM2M.objects.create(name='Tony')
chris = PersonSelfRefM2M.objects.create(name='Chris')
SymmetricalFriendship.objects.create(
first=tony, second=chris, date_friended=date.today(),
)
self.assertSequenceEqual(tony.sym_friends.all(), [chris])
# Manually created symmetrical m2m relation doesn't add mirror entry
# automatically.
self.assertSequenceEqual(chris.sym_friends.all(), [])
SymmetricalFriendship.objects.create(
first=chris, second=tony, date_friended=date.today()
)
self.assertSequenceEqual(chris.sym_friends.all(), [tony])

def test_add_on_symmetrical_m2m_with_intermediate_model(self):
tony = PersonSelfRefM2M.objects.create(name='Tony')
chris = PersonSelfRefM2M.objects.create(name='Chris')
date_friended = date(2017, 1, 3)
tony.sym_friends.add(chris, through_defaults={'date_friended': 
date_friended})
self.assertSequenceEqual(tony.sym_friends.all(), [chris])
self.assertSequenceEqual(chris.sym_friends.all(), [tony])
friendship = tony.symmetricalfriendship_set.get()
self.assertEqual(friendship.date_friended, date_friended)


So the tests show that the add() method needs to be used to create both 
sides of the relationship. I assume that the Admin page does not use the 
add method, but creates the intermediate entries which would require both 
the be added for each entry.

Is it possible to configure the Admin models to use add() or to create both 
directions automatically?

Thanks!


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3ad9f7f2-539f-4b66-9717-863d5f412ef4o%40googlegroups.com.


Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
On Thursday, June 25, 2020 at 10:26:25 AM UTC-4, Dan Madere wrote:
>
> I tried out the example code, and can replicate this. What's interesting 
> is that if I try removing the ContactConnection model, and the "through" 
> attribute, this allows Django to create the intermediate table on its own, 
> and then your get_connections() method works as expected! It seems like 
> using a custom through table is causing this somehow. I haven't found a fix 
> but will keep looking.


 Dan, thanks for looking into this issue.

I found the unit tests for this capability in 
https://github.com/django/django/tree/master/tests/m2m_through which seems 
to indicate that it does work.

I updated my version of Django to 3.1.b1 and copied the models and tests 
into my code. Neither the admin nor queries on the ManyToManyField return 
the full "symmetric" results.

Any other ideas?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/05819cd1-7c67-4c64-bfce-69934315782eo%40googlegroups.com.


Re: Looking for experience dgango developers to work on a Project

2020-06-25 Thread Ernest Thuku
  Hello,
I am interested in the position of a Django Developer. I have been working
with django thus have an experience. I would like to hear more about the
project.
Thank you,
Ernest Thuku

On Thu, Jun 25, 2020 at 5:55 PM BENDEV  wrote:

> Details of the project:
>
> The team of 7 developers will be building a cloud based documents
> management system.
>
> Duration of this work is 3 months.
>
> Interested and need more details about this project DM me Directly.
> (Solomontar2@gmail)
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4b3135a9-6e0d-4427-8e09-25bb5943399fo%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/CAPsfuofWUsLu0WTTXfV%3DyrmDqA5Ss9ZUDpi1Qq4i2kwG3fngrA%40mail.gmail.com.


Performing raw sql queries in database

2020-06-25 Thread tejas joshi
Hi,
I want to return the first occurrence of repetitive fields in my model.
I have a title field in my model as follows :

models.py 
class Post(models.Model):
title = models.CharField(max_length=20)

There will be multiple 'Post' with the same title.
I want to exectute the following query on the Post model

Post.objects.raw("SELECT title,ROW_NUMBER() OVER(PARTITION BY title ORDER 
BY title) AS row_num FROM basement_post;")

I am getting a syntax error "("
Is django not compatible with SQL server queries or am I missing something 
??

-- 
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/bc582b91-fa15-4ad3-a180-54e7457c4f50o%40googlegroups.com.


Looking for experience dgango developers to work on a Project

2020-06-25 Thread BENDEV
Details of the project:

The team of 7 developers will be building a cloud based documents management 
system.

Duration of this work is 3 months.

Interested and need more details about this project DM me Directly. 
(Solomontar2@gmail)

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b3135a9-6e0d-4427-8e09-25bb5943399fo%40googlegroups.com.


Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Dan Madere
I tried out the example code, and can replicate this. What's interesting is 
that if I try removing the ContactConnection model, and the "through" 
attribute, this allows Django to create the intermediate table on its own, 
and then your get_connections() method works as expected! It seems like 
using a custom through table is causing this somehow. I haven't found a fix 
but will keep looking.

On Thursday, June 25, 2020 at 8:52:47 AM UTC-4 jes...@gmail.com wrote:

> Mike, Thanks for your suggestions. 
>
> Just a stab in the dark - have you tried giving from_contact a 
>> related_name? 
>>
>
> Yes, I have tried a few different combinations of providing a single 
> related_name and various naming conventions when providing related_name on 
> both ForeignKey fields without success.
>  
>
>> Another stab ... maybe you could just display the 
>> ContactConnectionAdmin(admin.ModelAdmin) with model=ContactConnection? 
>>
>>
> Yes, adding a ModelAdmin for the through table will show all of the 
> relationships, but it still requires searching both ForeignKey fields to 
> capture all of the relationships, regardless of which Contact hey were 
> created on.
>
> Workarounds are to add two Inlines, one for each through table foreign 
> key, or perform a compound query to combine the two results. I just figured 
> that since the capability was added in Django 3.0, that the symmetric 
> queries were included as well. My guess is that it is possible with the 
> correct configuration / naming conventions. I'll dive into the code to see 
> if anything pops up.
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7ee482c1-60ea-482f-8ffb-5f71ff92a1edn%40googlegroups.com.


Re: Getting exception while importing data though Django Admin

2020-06-25 Thread Derek
This seems to be an error raised by a third-party library; you'd probably 
get a quicker / better response by contacting their devs.

On Thursday, 25 June 2020 00:25:18 UTC+2, Sasi Tiru wrote:
>
> Exception:
>
> \lib\site-packages\import_export\resources.py", line 581, in import_data
> raise ImproperlyConfigured
> django.core.exceptions.ImproperlyConfigured
>
>
>
>
> models.py
>
>
> class Supplier(models.Model) :
> supplier_id = models.IntegerField(primary_key=True)
> supplier_name = models.CharField(null=False, max_length=500)
>
> def __str__(self) :
> return self.supplier_name
>
>
>
> admin.py
>
> from django.contrib import admin
> from import_export.admin import ImportExportModelAdmin
>
> from .models import *
>
>
> # Register your models here.
> # @admin.register(Supplier)
> class SupplierAdmin(ImportExportModelAdmin) :
> pass
>
>
>
> resources.py
>
> from import_export import resources
>
> from .models import *
>
>
> class SupplierResource(resources.ModelResource) :
> class Meta :
> model = Supplier
> import_id_fields = ['supplier_id']
>
>

-- 
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/167ddea8-933e-4b11-a0a5-c3bcd961e4b3o%40googlegroups.com.


Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
Mike, Thanks for your suggestions. 

Just a stab in the dark - have you tried giving from_contact a 
> related_name? 
>

Yes, I have tried a few different combinations of providing a single 
related_name and various naming conventions when providing related_name on 
both ForeignKey fields without success.
 

> Another stab ... maybe you could just display the 
> ContactConnectionAdmin(admin.ModelAdmin) with model=ContactConnection? 
>
>
Yes, adding a ModelAdmin for the through table will show all of the 
relationships, but it still requires searching both ForeignKey fields to 
capture all of the relationships, regardless of which Contact hey were 
created on.

Workarounds are to add two Inlines, one for each through table foreign key, 
or perform a compound query to combine the two results. I just figured that 
since the capability was added in Django 3.0, that the symmetric queries 
were included as well. My guess is that it is possible with the correct 
configuration / naming conventions. I'll dive into the code to see if 
anything pops up.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1f730af3-11cb-49c6-a62f-e147107233a0o%40googlegroups.com.


Re: Reverse for 'process_data' not found. 'process_data' is not a valid view function or pattern name.

2020-06-25 Thread Ogunsanya Opeyemi
Look at your index path it is not written very well in the name you wrote
name=') without closing the apstorphe ' and request a url purely in your
template href like this href="process_data/{{ver}}".
And let me know wether it worked or not.

On Thursday, June 25, 2020, ratnadeep ray  wrote:

> Hi Ogunsanya,
>
> Now I added the same as per your suggestion. Following is my urls.py
> contnent
>
> from django.urls import path
> from fusioncharts import views
> app_name = 'fusioncharts'
>
>
> urlpatterns = [
> path('push-data/', views.push_data, name='push-data'),
> path('home/', views.home, name='home'),
> path('display_data/', views.display_data, name=
> 'display_data'),
> path('index/', views.index, name=''),
> *path**('process_data/', views.process_data,
> name='process_data'),*
> ]
>
> And my template content (process_data.py)is as follows:
>
> 
> 
> 
> Home
> 
> 
>   
>   Index page
>   
>   Select the version to compare with
>   
>  Select version to compare with
>  {%for ver in version_list%}
>  
> {{ver}}
>  {% endfor %}
>   
>   
>   The current version{{version}}
>   
>   
>   
> 
> 
>
>
> But now I am getting the following error:
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/index/11.5.1.18900-96
> http://127.0.0.1:8000/index/11.5.1.18900-97
>
>
> Using the URLconf defined in Piechart_Excel.urls, Django tried these URL
> patterns, in this order:
> admin/
> push-data/ [name='push-data']
> home/ [name='home']
> display_data/ [name='display_data']
> index/
> process_data/ [name='process_data']
>
> The current path, index/11.5.1.18900-96, didn't match any of these.
>
>
> Can you suggest now what's going wrong ?
>
>
>
> On Thursday, 25 June 2020 12:08:12 UTC+5:30, Ogunsanya Opeyemi wrote:
>>
>> Also include in your URL before your urlpatterns
>>
>> app_name=yourappname
>>
>>
>> And in your template URL  write
>> {% url 'yourappname:process_data' ver %}
>>
>>
>>
>> And if you still have issues send the update you made and let me check.
>>
>> On Thursday, June 25, 2020, ratnadeep ray  wrote:
>>
>>> Hi Ogunsanya,
>>>
>>> I have added that line of code but still getting the same error.
>>>
>>> So what can be done next ?
>>>
>>> On Thursday, 25 June 2020 00:25:17 UTC+5:30, Ogunsanya Opeyemi wrote:


 Yes
 On Wednesday, June 24, 2020, ratnadeep ray  wrote:

> So I need to add this also:
>
>
>
> urlpatterns = [
> ...
> ...
> path('process_data/', views.process_data, name='process_data'),
>
> --
> 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/5c62826f-a652
> -43c3-a89e-29cf1855a9f8o%40googlegroups.com.
>


 --
 OGUNSANYA OPEYEMI

 --
>>> 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/ms
>>> gid/django-users/bb999e9e-5fd9-45ec-9a59-86e3ed9b6454o%40goo
>>> glegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> OGUNSANYA OPEYEMI
>>
>> --
> 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/14aca6b8-8bc9-455a-b3c6-de0c8740a9a7o%
> 40googlegroups.com
> 
> .
>


-- 
OGUNSANYA OPEYEMI

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


Re: Project Collaboration Team

2020-06-25 Thread Lokesh Kumar
I'm interested.

Regards,
Lokesh Kumar

https://www.facebook.com/Lokeshk431
https://twitter.com/LokeshK431
https://www.instagram.com/lokeshk431/
https://github.com/LokeshK431

On Tue, Jun 23, 2020 at 9:44 AM Shubhanshu Arya 
wrote:

> Hello Everyone,
> I want to make a team in which we will make some very good level projects
> together. These projects will be very helpful in our interview as well.
> Must have prior knowledge about Django/Python. We will do daily meetings
> and discuss our project and we will use Github to team collaborations . If
> someone is interested to join this team please email me on
> shubhanshuarya...@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/53b14968-ae6f-428a-be58-5edd290f2487o%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/CADiRPBpSGzx%3D%2B5hK-zJGjuYDZ424gtOj0QBtQK9avsE9OyhaZg%40mail.gmail.com.


Re: Manage.py not working

2020-06-25 Thread Sainikhil Avula
Hey Tanisha try this command (django-admin startapp appName)
 

On Saturday, 20 June 2020 21:12:02 UTC+5:30, Tanisha Jain wrote:
>
> Hi everyone,
> I am new to Django platform. Whenever I am trying to create a new app 
> using  ( python manage.py startapp app1) then I am not able to create app. 
> Neither I get any error message in logs. Can someone plz suggest me what to 
> do now?
>

-- 
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/fa8b483f-bcb8-4469-bc6a-fae164cde448o%40googlegroups.com.


Re: Reverse for 'process_data' not found. 'process_data' is not a valid view function or pattern name.

2020-06-25 Thread ratnadeep ray
Hi Ogunsanya,

Now I added the same as per your suggestion. Following is my urls.py 
contnent

from django.urls import path
from fusioncharts import views
app_name = 'fusioncharts'


urlpatterns = [
path('push-data/', views.push_data, name='push-data'),
path('home/', views.home, name='home'),
path('display_data/', views.display_data, name=
'display_data'),
path('index/', views.index, name=''),
*path**('process_data/', views.process_data, 
name='process_data'),*
]

And my template content (process_data.py)is as follows: 




Home


  
  Index page
  
  Select the version to compare with
  
 Select version to compare with
 {%for ver in version_list%}
 
{{ver}}
 {% endfor %}
  
  
  The current version{{version}}
  
  
  




But now I am getting the following error: 

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/index/11.5.1.18900-96
http://127.0.0.1:8000/index/11.5.1.18900-97


Using the URLconf defined in Piechart_Excel.urls, Django tried these URL 
patterns, in this order:
admin/
push-data/ [name='push-data']
home/ [name='home']
display_data/ [name='display_data']
index/
process_data/ [name='process_data']

The current path, index/11.5.1.18900-96, didn't match any of these.


Can you suggest now what's going wrong ? 



On Thursday, 25 June 2020 12:08:12 UTC+5:30, Ogunsanya Opeyemi wrote:
>
> Also include in your URL before your urlpatterns 
>
> app_name=yourappname
>
>
> And in your template URL  write
> {% url 'yourappname:process_data' ver %}
>
>
>
> And if you still have issues send the update you made and let me check.
>
> On Thursday, June 25, 2020, ratnadeep ray  > wrote:
>
>> Hi Ogunsanya, 
>>
>> I have added that line of code but still getting the same error. 
>>
>> So what can be done next ? 
>>
>> On Thursday, 25 June 2020 00:25:17 UTC+5:30, Ogunsanya Opeyemi wrote:
>>>
>>>
>>> Yes
>>> On Wednesday, June 24, 2020, ratnadeep ray  wrote:
>>>
 So I need to add this also:



 urlpatterns = [
 ...
 ...
 path('process_data/', views.process_data, name='process_data'),

 -- 
 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/5c62826f-a652-43c3-a89e-29cf1855a9f8o%40googlegroups.com
 .

>>>
>>>
>>> -- 
>>> OGUNSANYA OPEYEMI
>>>
>>> -- 
>> 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/bb999e9e-5fd9-45ec-9a59-86e3ed9b6454o%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> OGUNSANYA OPEYEMI
>
>

-- 
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/14aca6b8-8bc9-455a-b3c6-de0c8740a9a7o%40googlegroups.com.


Django Admin: how to link to another model from one model list view ?

2020-06-25 Thread Olivier
Hello,

Let say your app deals with Book and Author models.

Within Django Admin, you can display a list of currently stored Books.
I
How can you implement the following:
1. For each Book entry within Book Listing page (like 
http://foobar.com/admin/myapp/book/), book's title and authors arr both 
displayed,
2. When clicking over book's title, you go to book edit page (like 
http://foobar.com/admin/myapp/book/7/change)
3. When clicking over any of book's authors,  you go to corresponding 
author edit page (like http://foobar.com/admin/myapp/author/25/change)

I did tried with list_display_links but it linked to Book edit page, not 
Author edit page.

I also tried with building custom URLs like Author Name, but it exactly this 
URL value
instead of showing a link.
(looking at page source code, it seems my browser received an escaped value 
like "a href= ..." instead of expected " href= ...").

Any hint ?

Best regards

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


Re: using serializers with POST requests

2020-06-25 Thread maninder singh Kumar
Seems like the loop doesn't go anywhere but the "else" part where it says
fail.  Perhaps you need to relook keyword or positional arguments

Maninder Kumar
about.me/maninder.s.kumar



On Thu, Jun 25, 2020 at 3:55 AM Arpana Mehta 
wrote:

>
> https://stackoverflow.com/questions/62561906/django-adding-a-new-row-in-a-table-based-on-a-foreign-key-value-using-serializ
>
>
> Please visit this link!! I have posted my question with details there.
> It's super urgent.
>
> --
> 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/a8957681-396a-4e78-b0ae-526d577f3eb8o%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/CABOHK3Q0ZeDe_Wiq5AfoA5-%2BW-mu%3D_8sL56zaexLY0SPBwOGUg%40mail.gmail.com.


Re: Reverse for 'process_data' not found. 'process_data' is not a valid view function or pattern name.

2020-06-25 Thread Ogunsanya Opeyemi
Also include in your URL before your urlpatterns

app_name=yourappname


And in your template URL  write
{% url 'yourappname:process_data' ver %}



And if you still have issues send the update you made and let me check.

On Thursday, June 25, 2020, ratnadeep ray  wrote:

> Hi Ogunsanya,
>
> I have added that line of code but still getting the same error.
>
> So what can be done next ?
>
> On Thursday, 25 June 2020 00:25:17 UTC+5:30, Ogunsanya Opeyemi wrote:
>>
>>
>> Yes
>> On Wednesday, June 24, 2020, ratnadeep ray  wrote:
>>
>>> So I need to add this also:
>>>
>>>
>>>
>>> urlpatterns = [
>>> ...
>>> ...
>>> path('process_data/', views.process_data, name='process_data'),
>>>
>>> --
>>> 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/ms
>>> gid/django-users/5c62826f-a652-43c3-a89e-29cf1855a9f8o%40goo
>>> glegroups.com.
>>>
>>
>>
>> --
>> OGUNSANYA OPEYEMI
>>
>> --
> 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/bb999e9e-5fd9-45ec-9a59-86e3ed9b6454o%
> 40googlegroups.com
> 
> .
>


-- 
OGUNSANYA OPEYEMI

-- 
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/CABJxPrGsZfvjER6zE%2BjARn_9Z971Kxru5e4f-Mx8%2BY%3D4UWhxng%40mail.gmail.com.