Re: django context data into javascript

2020-02-25 Thread Naveen Arora
Hi, this is simple just enclose {{name}} into " " as "{{name}}" for your 
part.

Thanks

On Tuesday, 25 February 2020 15:56:05 UTC+5:30, Soumen Khatua wrote:
>
> Hi Folks,
>
> I'm sending some context data into html like 
> name = 'soumen'
> return render(request,'xyz.html', context = {'name':name})
>
> inside myjs.js(js script has been integrated to html):
> ---
> var my_name = {{name}};
>
> I'm getting an error::: Uncaught SyntaxError: Unexpected token '{'
>
> So,How I can render data into frontend??
>
> Thank You 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/b6c9cd98-b9bd-4178-919a-13d8156029a6%40googlegroups.com.


Re: reg: Error:-django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'Description' used in key specification without a key length")

2020-02-25 Thread Naveen Arora
This can be resolved using max_length attribute. If it doesn't work try 
deleting the migration files and doing makemigrations and migrate again.

On Monday, 24 February 2020 20:14:25 UTC+5:30, Amitesh Sahay wrote:
>
> Hi, 
>
> I am creating a model, which is taking a description as text field. when I 
> migrate I see the below error:
>
> django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'Description' 
> used in key specification without a key length")
>
> ON further research I came to know that its some limitation with MySQL. I 
> am using MYSQL for my dev. Below is the link that describes the issue.
>
> MySQL error: key specification without a key length 
> 
>
> MySQL error: key specification without a key length
>
> I have a table with a primary key that is a varchar(255). Some cases have 
> arisen where 255 characters isn't enou...
>
> 
>
> *So what am I suppose to use if not TextField? I have tried CharField, 
> that doesn't work either. Below is the model details:*
>
>
>
>
>
>
>
>
>
> *class OnlineShop(models.Model): Product_name = 
> models.CharField(max_length=100, unique=True) Price = models.IntegerField() 
> Slug = models.SlugField(max_length=250, unique=True) Description = 
> models.TextField() Curr_Time = models.DateTimeField(auto_now_add=True) def 
> __str__(self): return '{}'.format(self.Product_name)*
>
>
> Regards,
> Amitesh Sahay
> *91-750 797 8619*
>

-- 
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/277413b1-79a0-4e87-a181-f7dba4b23489%40googlegroups.com.


Re: 'ssl_disabled' is an invalid keyword argument for connect()

2020-02-25 Thread Naveen Arora
Hi sir,

Kindly use this as below,

'OPTIONS': {
'ssl' : {
'ssl_disabled': True
        }
    }

Cheers,
Naveen Arora

On Wednesday, 26 February 2020 04:25:29 UTC+5:30, Stephen Loughin wrote:
>
> The django doc 
> <https://docs.djangoproject.com/en/3.0/ref/databases/#mysql-notes>s say I 
> can pass OPTIONS for the db connection here:
>
> DATABASES = {
>
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> 'OPTIONS': {
> 'ssl_disabled': 'True',
> },
> 'NAME': 'somedatabase',
> 'USER': 'someuser',
> 'PASSWORD': 'somepassword',
> 'HOST': '10.0.0.1',  
> 'PORT': '3306',
> }
>
> Yet when I try python manage.py runserver I get this:
>
> TypeError: 'ssl_disabled' is an invalid keyword argument for connect()
>
> I have also tried 'ssl_disabled': True,  # that is an actual boolean 
> rather than string...
> Same result.  Running django 3 and python 3.7.4 
>
> Thanks,
> -- Steve
> slou...@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/2dbfa0b2-6e91-4a21-89d6-f8adb5383ceb%40googlegroups.com.


Re: allauth- signup redirect

2020-02-25 Thread Naveen Arora


Hi Tosin,


The simplest way would be to override the template account/signup.html with 
your own copy. If you examine that template you will see the following 
section:

{% if redirect_field_value %}{% endif %}

If you remove the if/endif part and change the value inside, the signup 
page will redirect to a specific page, even if you pass a next argument in 
the URL:




Cheers,
Naveen Arora

On Tuesday, 25 February 2020 23:58:02 UTC+5:30, Tosin Ayoola wrote:
>
> halo guy, i'm using allauth for my authentication, but i wan redirect the 
> signup user to a page where they get update their profile detail, how do i 
> override the default success_url after the user have successfully signup ,  
>
>
>
>
>
>

-- 
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/7e5a5842-1aef-4afe-9cd1-46e1e40534fb%40googlegroups.com.


Re: Django Session KeyError

2020-02-25 Thread Naveen Arora
Hi, 

please post the output of debugging the above, print after and before in 
these views and also check is something else is working using 
request.session. 
@csrf_exempt
def upload_local_dataset(request):
if request.method == 'POST':
dataset = pd.read_csv(request.FILES.get('datasetfilepath'),
 header=None, index_col=None)
request.session['ts_datset'] = dataset.to_json(orient='values')
print(dataset.to_json(orient='values'))
request.session['ts_dataset_copy'] = dataset.to_json(orient=
'values')
print(request.session['ts_dataset_copy'])
return HttpResponse(dataset.to_json(orient='values'))
Post output of this plus the below one
def cv_classification(request, kfolds, dissimilarity_func, windows_length=0,
 noisy_law="", mu=0,std=0):
noisy_law = noisy_law.lower()
print(request.session['ts_dataset_copy'])
df = pd.read_json(request.session['ts_dataset_copy'], orient=
'values')
predictions = cv_classify(df, kfolds, dissimilarity_func,
 windows_length, noisy_law, mu, std)
return JsonResponse(predictions, safe=False)

On Tuesday, 25 February 2020 03:47:25 UTC+5:30, Guy NANA wrote:
>
> I have an angular frontend app which send file to django backend which 
> data is setting in django session. After I send a httprequest to django 
> backend to make ML tratements on that data and get the results. But I've a 
> 500 sever error: keyerror 'ts_dataset_copy': KeyError: 'ts_dataset_copy'
> [24/Feb/2020 18:43:46] "GET /cv_classification/5/FOTS/283/None/0/0 
> HTTP/1.1" 500 78264. Here are my django code:
>
> Firstly I upload timeseries dataset file from angular frontend (All thing 
> is ok)
> @csrf_exempt
> def upload_local_dataset(request):
> if request.method == 'POST':
> dataset = pd.read_csv(request.FILES.get('datasetfilepath'), 
> header=None, index_col=None)
> request.session['ts_datset'] = dataset.to_json(orient='values'
> )
> request.session['ts_dataset_copy'] = dataset.to_json(orient=
> 'values')
> 
> return HttpResponse(dataset.to_json(orient='values'))
>
>
>
> # second httrequest that throws a server internal error
>
> def cv_classification(request, kfolds, dissimilarity_func, 
> windows_length=0, noisy_law="", mu=0, 
> 
> std=0):
> noisy_law = noisy_law.lower()
> df = pd.read_json(request.session['ts_dataset_copy'], orient=
> 'values')
> predictions = cv_classify(df, kfolds, dissimilarity_func, 
> windows_length, noisy_law, mu, std)
> return JsonResponse(predictions, safe=False)
>
>
>
> Thanks for your help!
>

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


Re: From and Template in Django

2020-02-25 Thread Naveen Arora
Hi ben,

You can use the same form any number of times passing it through views.

Also, you can create a form.html which you can include anywhere for HTML 
forms using include tag.

Cheers
Naveen Arora

On Wednesday, 26 February 2020 04:25:29 UTC+5:30, ben aziz zizah wrote:
>
> Is that possible to use the same form in more than one template 
>

-- 
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/57795aff-1e7e-4520-b8bf-906f1b7b1445%40googlegroups.com.


Re: Django Session KeyError

2020-02-26 Thread Naveen Arora
this simple means request.session is empty in the view you are trying to 
access it. Can you test request.session for simple strings if it is working 
at all. need to checkout what exact problem is. For reference check out -
https://docs.djangoproject.com/en/3.0/topics/http/sessions/. 
One more thing check if cookies are not disabled for localhost
Also , are you logged in ? Try after logging in as superuser.

Cheers,
Naveen Arora 

On Wednesday, 26 February 2020 14:26:22 UTC+5:30, Guy NANA wrote:
>
> Hi! Please find bellow the outputs. When I was using sessions stored in 
> cache (specially in Memcached) all things were working good until I 
> wanted to upload a data set with larger volume of data : it wasn't be 
> possible to put them in cache.
>
>
> Training dataset uploaded :  Coffee
> training dataset saved in django session : 
>
>
>  
> [[0,-0.51841899,-0.48588363,-0.50500747,-0.56018294,-0.63629941,-0.75322902,-0.82722915,-0.85976467,-0.90632072,-0.92379648,-0.93321222,-0.93442926,-0.92078716,-0.93657191,-0.95599685,-0.95934101,-0.96940599,-0.9824055,-0.97659952,-0.96252576,-0.97031893,-0.98199237,-0.9874616,-1.0152202,-1.0480611,-1.0592421,-1.0498854,-1.0467321,-1.0643986,-1.0877935,-1.0993351,-1.0850813,-1.0641912,-1.0545229,-1.044503,-1.0236367,-0.99421712,-0.96371982,-0.92237217,-0.86616903,-0.81351574,-0.77266759,-0.72343976,-0.66424331,-0.63424598,-0.6280451,-0.60469363,-0.56829781,-0.53778323,-0.50569966,-0.4612259,-0.38892741,-0.29296669,-0.20056328,-
> ...
>
> 582,-1.7619773,-1.7640397,-1.7661713,-1.7689397,-1.7722404,-1.7751282,-1.7766233,-1.7782533,-1.7809291,-1.7835006,-1.7858671,-1.7878936,-1.7896332,-1.791887,-1.7937475,-1.795334,-1.7968732]]
>
>
> training dataset copy saved in django session : 
>  0 1 2 3 4 5 6 
> 7 8...   278   279   280   281   282   
> 283   284   285   286
> 0 0 -0.518419 -0.485884 -0.505007 -0.560183 -0.636299 -0.753229 
> -0.827229 -0.859765  ... -1.922313 -1.924212 -1.926997 -1.928721 -1.930026 
> -1.932301 -1.933631 -1.934963 -1.936007
>
> 231 -0.654035 -0.634715 -0.625911 -0.650577 -0.710112 -0.793933 
> -0.876500 -0.917085  ... -1.758149 -1.760285 -1.763167 -1.766203 -1.768161 
> -1.769878 -1.771651 -1.772835 -1.774231
> 241 -0.675463 -0.617801 -0.619069 -0.664476 -0.751102 -0.841188 
> -0.900013 -0.937926  ... -1.733537 -1.736082 -1.738777 -1.741560 -1.743612 
> -1.745258 -1.747073 -1
> 501 -0.674712 -0.633369 -0.648089 -0.706044 -0.763404 -0.841210 
> -0.926266 -0.967801  ... -1.798162 -1.800553 -1.803785 -1.806106 -1.808189 
> -1.810410 -1.812302 -1.814185 -1.815227
> 511 -0.637021 -0.624313 -0.602822 -0.644700 -0.735494 -0.798365 
> -0.866908 -0.920802  ... -1.777194 -1.779707 -1.782322 -1.784423 -1.786802 
> -1.789479 
> 551 -0.665276 -0.636800 -0.639735 -0.687703 -0.760849 -0.839653 
> -0.898612 -0.923578  ... -1.780929 -1.783501 -1.785867 -1.787894 -1.789633 
> -1.791887 -1.793747 -1.795334 -1.796873
>
> [56 rows x 287 columns]
> In upload_local_dataset Session's keys :  dict_keys(['ts_dataset', 
> 'ts_dataset_copy'])
> [26/Feb/2020 08:20:09] "POST /upload_dataset HTTP/1.1" 200 176589
> [26/Feb/2020 08:20:13] "GET /uts_datasets HTTP/1.1" 200 35673
> In cv_classification Session's keys :  dict_keys([])
> Internal Server Error: /cv_classification/5/FOTS/283/None/0/0
> Traceback (most recent call last):
>   File 
> "/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/django/core/handlers/exception.py",
>  
> line 34, in inner
> response = get_response(request)
>   File 
> "/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/django/core/handlers/base.py",
>  
> line 115, in _get_response
> response = self.process_exception_by_middleware(e, request)
>   File 
> "/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/django/core/handlers/base.py",
>  
> line 113, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File 
> "/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/djangobackend/tsanalysisapp/views.py",
>  
> line 260, in cv_classification
> df = pd.read_json(request.session.get('ts_dataset_copy'), orient='
> values')
>   File 
> "/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/pandas/io/json/_json.py",
>  
> line 569, in read_json
> path_or_buf, encoding=encoding, compression=compression
>   File 
> "/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/l

Re: Admin login problem

2020-02-26 Thread Naveen Arora
Hi soumen, 

Are you overriding default user model,  if yes check user.is_admin=True.
or else, Please post the exact error

Cheers
Naveen Arora
On Wednesday, 26 February 2020 17:43:51 UTC+5:30, Soumen Khatua wrote:
>
> Hi Folks,
> after creating superuser by using this command python manage.py 
> createsuperuser. Whenever I'm entering the same(exact) login 
> credentials.I'm getting this error:
> Please enter the correct phone number and password for a staff 
> account. Notethat both fields may be case-sensitive .
>
> But don't why i'm getting this error message.
>
>
> Thank you in advance
>
> Regards,
> Soumen
>

-- 
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/7f3894dd-6fd2-455a-975a-2f03f5041c16%40googlegroups.com.


Re: Admin login problem

2020-02-26 Thread Naveen Arora
Share all of the code related to this model what you have overriden from 
nodel to admin registeration part also. Also check through terminal if 
superuser has been created successfully.
Did you override something related to login part too..?
Share code please. 

On Wednesday, 26 February 2020 17:57:19 UTC+5:30, Soumen Khatua wrote:
>
> Yes I'm using custom user model and I already added user.is_admin=True. 
> But still I'm getting the same error.
> I attached the code snippet as well as error message also. 
>
>
>
> On Wed 26 Feb, 2020, 5:47 PM Naveen Arora,  > wrote:
>
>> Hi soumen, 
>>
>> Are you overriding default user model,  if yes check user.is_admin=True.
>> or else, Please post the exact error
>>
>> Cheers
>> Naveen Arora
>> On Wednesday, 26 February 2020 17:43:51 UTC+5:30, Soumen Khatua wrote:
>>>
>>> Hi Folks,
>>> after creating superuser by using this command python manage.py 
>>> createsuperuser. Whenever I'm entering the same(exact) login 
>>> credentials.I'm getting this error:
>>> Please enter the correct phone number and password for a staff 
>>> account. Notethat both fields may be case-sensitive .
>>>
>>> But don't why i'm getting this error message.
>>>
>>>
>>> Thank you in advance
>>>
>>> Regards,
>>> Soumen
>>>
>> -- 
>> 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/7f3894dd-6fd2-455a-975a-2f03f5041c16%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/7f3894dd-6fd2-455a-975a-2f03f5041c16%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

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


Re: consume Google API through REST API

2020-02-26 Thread Naveen Arora
Hi,

Please refer here how to upload a file through Django - 
https://www.geeksforgeeks.org/python-uploading-images-in-django/. 
Might be this tutorial of mine help you - 
https://www.geeksforgeeks.org/python-django-google-authentication-and-fetching-mails-from-scratch/

You can ask here too anytime.

Cheers,
Naveen Arora

On Wednesday, 26 February 2020 18:00:09 UTC+5:30, New Django user wrote:
>
> I am new to Django and building a simple webpage where the user can upload 
> a file and then that file will be processed using Google API. I am done 
> with creating a user login page but not sure how to start with the 2nd part 
> i.e. file upload and Google API.
>
> Can anyone help me or suggest some tutorials to start with? I need to use 
> REST API to consume Google API.
>

-- 
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/9ddd72c5-06ae-4a98-8864-e63e5f848b6e%40googlegroups.com.


Re: logged in and got logout immediately upon reload the page

2020-02-26 Thread Naveen Arora
Hi Roy,

Share the exact problem with screenshots and code if possible. Did you set 
default authentication model of user to yours..?

Cheers,
Naveen Arora

On Wednesday, 26 February 2020 18:00:10 UTC+5:30, Roy Huang wrote:
>
> Hi all,
>
> any help will be appreciated, i've bee stuck on this for days, couldnt 
> find answers
>
> ok, here it is,
>
> 1) logged in and retrieved data back to a page, all good (got sessionid 
> and csrftoken)
>
> 2) make a request on a view which has got @login_required, then got 
> redirect to login (apparently sessionid got cleared )
>
> any thoughts ?
>
> thanks
>
> donkey
>

-- 
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/961db9ac-23d8-44c3-a67b-d95d32c26a48%40googlegroups.com.


Re: Django Session KeyError

2020-02-26 Thread Naveen Arora
Are you using SESSION_COOKIE_DOMAIN in your settings.py ?
Are you on local server only ?
Are you logged in while maintaining a session ?
Have you run the migrate command ? Without makemigrations and migrate 
properly session doesn't work !
Run manage.py syncdb from the command line.

References - 
https://www.geeksforgeeks.org/python-sessions-framework-using-django/
https://stackoverflow.com/questions/2293291/create-a-session-in-django
https://docs.djangoproject.com/en/3.0/topics/http/sessions/

If it still doesn't work after trying kindly share the github code. 

Peace
Naveen Arora


On Wednesday, 26 February 2020 19:31:36 UTC+5:30, Guy NANA wrote:
>
> I checked request.session for simple string (by adding 
> *request.session['func_views'] 
> = 'upload_local_dataset' in the upload_local_dataset view*) but it is 
> always have an empty request.session in the second view.
>
> Le mercredi 26 février 2020 11:14:23 UTC+1, Naveen Arora a écrit :
>>
>> this simple means request.session is empty in the view you are trying to 
>> access it. Can you test request.session for simple strings if it is working 
>> at all. need to checkout what exact problem is. For reference check out -
>> https://docs.djangoproject.com/en/3.0/topics/http/sessions/. 
>> One more thing check if cookies are not disabled for localhost
>> Also , are you logged in ? Try after logging in as superuser.
>>
>> Cheers,
>> Naveen Arora 
>>
>> On Wednesday, 26 February 2020 14:26:22 UTC+5:30, Guy NANA wrote:
>>>
>>> Hi! Please find bellow the outputs. When I was using sessions stored in 
>>> cache (specially in Memcached) all things were working good until I 
>>> wanted to upload a data set with larger volume of data : it wasn't be 
>>> possible to put them in cache.
>>>
>>>
>>> Training dataset uploaded :  Coffee
>>> training dataset saved in django session : 
>>>
>>>
>>>  
>>> [[0,-0.51841899,-0.48588363,-0.50500747,-0.56018294,-0.63629941,-0.75322902,-0.82722915,-0.85976467,-0.90632072,-0.92379648,-0.93321222,-0.93442926,-0.92078716,-0.93657191,-0.95599685,-0.95934101,-0.96940599,-0.9824055,-0.97659952,-0.96252576,-0.97031893,-0.98199237,-0.9874616,-1.0152202,-1.0480611,-1.0592421,-1.0498854,-1.0467321,-1.0643986,-1.0877935,-1.0993351,-1.0850813,-1.0641912,-1.0545229,-1.044503,-1.0236367,-0.99421712,-0.96371982,-0.92237217,-0.86616903,-0.81351574,-0.77266759,-0.72343976,-0.66424331,-0.63424598,-0.6280451,-0.60469363,-0.56829781,-0.53778323,-0.50569966,-0.4612259,-0.38892741,-0.29296669,-0.20056328,-
>>> ...
>>>
>>> 582,-1.7619773,-1.7640397,-1.7661713,-1.7689397,-1.7722404,-1.7751282,-1.7766233,-1.7782533,-1.7809291,-1.7835006,-1.7858671,-1.7878936,-1.7896332,-1.791887,-1.7937475,-1.795334,-1.7968732]]
>>>
>>>
>>> training dataset copy saved in django session : 
>>>  0 1 2 3 4 5 6   
>>>   7 8...   278   279   280   281   282 
>>>   283   284   285   286
>>> 0 0 -0.518419 -0.485884 -0.505007 -0.560183 -0.636299 -0.753229 
>>> -0.827229 -0.859765  ... -1.922313 -1.924212 -1.926997 -1.928721 -1.930026 
>>> -1.932301 -1.933631 -1.934963 -1.936007
>>>
>>> 231 -0.654035 -0.634715 -0.625911 -0.650577 -0.710112 -0.793933 
>>> -0.876500 -0.917085  ... -1.758149 -1.760285 -1.763167 -1.766203 -1.768161 
>>> -1.769878 -1.771651 -1.772835 -1.774231
>>> 241 -0.675463 -0.617801 -0.619069 -0.664476 -0.751102 -0.841188 
>>> -0.900013 -0.937926  ... -1.733537 -1.736082 -1.738777 -1.741560 -1.743612 
>>> -1.745258 -1.747073 -1
>>> 501 -0.674712 -0.633369 -0.648089 -0.706044 -0.763404 -0.841210 
>>> -0.926266 -0.967801  ... -1.798162 -1.800553 -1.803785 -1.806106 -1.808189 
>>> -1.810410 -1.812302 -1.814185 -1.815227
>>> 511 -0.637021 -0.624313 -0.602822 -0.644700 -0.735494 -0.798365 
>>> -0.866908 -0.920802  ... -1.777194 -1.779707 -1.782322 -1.784423 -1.786802 
>>> -1.789479 
>>> 551 -0.665276 -0.636800 -0.639735 -0.687703 -0.760849 -0.839653 
>>> -0.898612 -0.923578  ... -1.780929 -1.783501 -1.785867 -1.787894 -1.789633 
>>> -1.791887 -1.793747 -1.795334 -1.796873
>>>
>>> [56 rows x 287 columns]
>>> In upload_local_dataset Session's keys :  dict_keys(['ts_dataset', 
>>> 'ts_dataset_copy'])
>>> [26/Feb/2020 08:20:09] "POST /upload_dataset HTTP/1.1" 200 176589
>>> [26/Feb/2020 08:20:13] "GET /uts_datasets HTTP/1.1" 200 35673
>>> In cv_clas

Re: Unidirectional association

2020-02-26 Thread Naveen Arora
Hi Manos,

Kindly explain the scenario appropriately, What exactly are you trying to 
achieve? Also read - 
https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_many/

Cheers,
Naveen Arora


On Wednesday, 26 February 2020 20:05:00 UTC+5:30, Manos Zeakis wrote:
>
> Hi all
>
> I have created two classes. Instances of class A are timeless and 
> instances of class B are different each year. Each instance of class B is 
> associated with an instance of class A.
>
> So I suppose I should do something like this
>
> class A(models.Model):
> name = models.CharField(max_length=20, default = 'null')
>
> class B(models.Model):
> A = models.ForeignKey('A', on_delete=models.CASCADE, related_name = 
> "bs")
> 
> Now I need to declare three fields on class A that point to a different 
> instance of class B for current, past and next year
> current_B
> previous_B
> next_B
>
> I cannot find a way to declare such an association. Could you help me?
>
> 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/922a9384-0a29-4253-8bb4-fcab9b39247a%40googlegroups.com.


Re: logged in and got logout immediately upon reload the page

2020-02-26 Thread Naveen Arora
All you need to do is set AUTH_USER_MODEL = "Yourapp.yourmodelname" in your 
setttings.py, delete your entire database and run makemigrations and 
migrate again.
Django sets the default user model at first migration only.

Hope this helps, you can ask here for your queries.
Cheers,
Naveen Arora

On Wednesday, 26 February 2020 20:11:27 UTC+5:30, Roy Huang wrote:
>
> thanks Naveen 
>
> wow, how did you even guess that !! yes I did have my own authentication 
> model on top of the original one
>
> I will put up more detail first thing tomorrow at work, so glad somebody 
> can help me out (crying ~~)
>
> Roy
>
> Naveen Arora於 2020年2月26日星期三 UTC+8下午9時46分32秒寫道:
>>
>> Hi Roy,
>>
>> Share the exact problem with screenshots and code if possible. Did you 
>> set default authentication model of user to yours..?
>>
>> Cheers,
>> Naveen Arora
>>
>> On Wednesday, 26 February 2020 18:00:10 UTC+5:30, Roy Huang wrote:
>>>
>>> Hi all,
>>>
>>> any help will be appreciated, i've bee stuck on this for days, couldnt 
>>> find answers
>>>
>>> ok, here it is,
>>>
>>> 1) logged in and retrieved data back to a page, all good (got sessionid 
>>> and csrftoken)
>>>
>>> 2) make a request on a view which has got @login_required, then got 
>>> redirect to login (apparently sessionid got cleared )
>>>
>>> any thoughts ?
>>>
>>> thanks
>>>
>>> donkey
>>>
>>

-- 
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/7a9b82d6-29ad-4eae-b9ca-608d37226909%40googlegroups.com.


Re: relation "django_session" does not exist

2020-02-26 Thread Naveen Arora
Run migrations all over the app again. Plus run -python manage.py syncdb

On Thursday, 27 February 2020 06:39:31 UTC+5:30, Hella Nick wrote:
>
> Me to,My error was is
> Traceback (most recent call last):
>   File 
> "D:\Python3\lib\site-packages\django\contrib\sessions\backends\base.py", 
> line 190, in _get_session
> return self._session_cache
> AttributeError: 'SessionStore' object has no attribute '_session_cache'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>
>

-- 
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/286920ed-8f6b-44d7-a930-11a936f48460%40googlegroups.com.


Re: logged in and got logout immediately upon reload the page

2020-02-28 Thread Naveen Arora
cool :)

Cheers,
Naveen Arora

On Thursday, 27 February 2020 12:06:37 UTC+5:30, Roy Huang wrote:
>
> Hi Naveen,
>
> thank you once again for the help
>
> after days of struggling, finally i've got enlightened all of a sudden !
>
> to put it in simple way, 
>
> we have a sync mechanism, which sync local code to production, and we've 
> forgot to exclude db.sqlite3 which accounts resides 
>
> -_- ... what a bummer
>
> thanks Naveen
>
>
>
> Naveen Arora於 2020年2月27日星期四 UTC+8下午1時57分28秒寫道:
>>
>> All you need to do is set AUTH_USER_MODEL = "Yourapp.yourmodelname" in 
>> your setttings.py, delete your entire database and run makemigrations and 
>> migrate again.
>> Django sets the default user model at first migration only.
>>
>> Hope this helps, you can ask here for your queries.
>> Cheers,
>> Naveen Arora
>>
>> On Wednesday, 26 February 2020 20:11:27 UTC+5:30, Roy Huang wrote:
>>>
>>> thanks Naveen 
>>>
>>> wow, how did you even guess that !! yes I did have my own authentication 
>>> model on top of the original one
>>>
>>> I will put up more detail first thing tomorrow at work, so glad somebody 
>>> can help me out (crying ~~)
>>>
>>> Roy
>>>
>>> Naveen Arora於 2020年2月26日星期三 UTC+8下午9時46分32秒寫道:
>>>>
>>>> Hi Roy,
>>>>
>>>> Share the exact problem with screenshots and code if possible. Did you 
>>>> set default authentication model of user to yours..?
>>>>
>>>> Cheers,
>>>> Naveen Arora
>>>>
>>>> On Wednesday, 26 February 2020 18:00:10 UTC+5:30, Roy Huang wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> any help will be appreciated, i've bee stuck on this for days, couldnt 
>>>>> find answers
>>>>>
>>>>> ok, here it is,
>>>>>
>>>>> 1) logged in and retrieved data back to a page, all good (got 
>>>>> sessionid and csrftoken)
>>>>>
>>>>> 2) make a request on a view which has got @login_required, then got 
>>>>> redirect to login (apparently sessionid got cleared )
>>>>>
>>>>> any thoughts ?
>>>>>
>>>>> thanks
>>>>>
>>>>> donkey
>>>>>
>>>>

-- 
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/79f743b7-ec75-4b60-9199-733609b98557%40googlegroups.com.


Re: Unidirectional association

2020-02-28 Thread Naveen Arora
great. Happy to help :)

Cheers

On Thursday, 27 February 2020 13:46:10 UTC+5:30, Manos Zeakis wrote:
>
> Thank you
>
> I finally made it. I was afraid about circular references and DB possible 
> corruptions, but Django seems to be resilient and surprises me all the time.
>
> What I did was
>
> 1. Declared three different ForeignKeys from class A to B
> 2. Chose PROTECT instead of CASCADE for on_delete
> 3. Let blank/null True
> 4. Of course chose three different related_names
>
>
> On Thursday, 27 February 2020 07:55:52 UTC+2, Naveen Arora wrote:
>>
>> Hi Manos,
>>
>> Kindly explain the scenario appropriately, What exactly are you trying to 
>> achieve? Also read - 
>> https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_many/
>>
>> Cheers,
>> Naveen Arora
>>
>>
>> On Wednesday, 26 February 2020 20:05:00 UTC+5:30, Manos Zeakis wrote:
>>>
>>> Hi all
>>>
>>> I have created two classes. Instances of class A are timeless and 
>>> instances of class B are different each year. Each instance of class B is 
>>> associated with an instance of class A.
>>>
>>> So I suppose I should do something like this
>>>
>>> class A(models.Model):
>>> name = models.CharField(max_length=20, default = 'null')
>>>
>>> class B(models.Model):
>>> A = models.ForeignKey('A', on_delete=models.CASCADE, related_name = 
>>> "bs")
>>> 
>>> Now I need to declare three fields on class A that point to a different 
>>> instance of class B for current, past and next year
>>> current_B
>>> previous_B
>>> next_B
>>>
>>> I cannot find a way to declare such an association. Could you help me?
>>>
>>> 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/be0389bd-d4f7-4f9d-88d0-ad483596f089%40googlegroups.com.


Re: production setup

2020-02-28 Thread Naveen Arora
Hi Soumen,

https://docs.djangoproject.com/en/3.0/howto/static-files/deployment/
https://docs.djangoproject.com/en/3.0/howto/static-files/

Have a look here. Hope it helps :)
Cheers

On Thursday, 27 February 2020 16:48:46 UTC+5:30, Soumen Khatua wrote:
>
> Hi Folks,
>
> I'm storing users images and documents inside media folder during 
> development. but I don't how to serve this files for production level.Any 
> one have any idea, actually I read the documentation but I'm still confuse.
>
> Thank You in advance
>
>
> regards,
> soumen
>  
>

-- 
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/4042f87e-cd0a-48e6-b79a-9070cde603da%40googlegroups.com.


Re: Is it possible to extend the model in another application without explicitly changing firs-one?

2020-02-28 Thread Naveen Arora
Clearly Possible, 
Simply import the model first using appname.models. Hope it helps:)
You can use this as
from appA import model1
in app2

On Thursday, 27 February 2020 22:04:12 UTC+5:30, Ol P wrote:
>
> Imagen we have *app-A* and *app-B* with *model-A* and *model-B* 
> accordingly.
> And we want to extend *model-A* in *app-B*.
> What should be written in *model-B* to implement it?
>
> In other words, is it possible to implement the same-table extension?
>

-- 
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/42c4791e-ea38-4e4b-947f-07eaf4c740bc%40googlegroups.com.


Re: How to do validation on a form which is opened by clicking a button

2020-02-28 Thread Naveen Arora
Use this as below  in your view - 

context["form"] = YourForm(request.POST or None)

and just a method if form.is_valid(), there is no need for the else part.

On Friday, 28 February 2020 02:41:04 UTC+5:30, Sunil BK wrote:
>
> Hello community
>
> I am trying to build a simple form which can be opened using a button. It 
> should offer some fields which should be further process after validation. 
> And there is exactly my issue. When I write some data into the fields and 
> click the submit button. the validation error is NOT displayed below the 
> screen like in this screeshot:
>
> [image: 2020-02-27_21-52-30.png]
>
>
> but is displayed in the log.
>
> Can somebody give me a hint what I am missing here?
> Thanks a lot!!
> Sunil
>
>
> This is the code I am using:
>
> my HTML Code for presenting the form.
>
> {% extends 'base.html' %}
> {% load crispy_forms_tags %}
> {%block content%}
> 
> Add System to Organization
> 
> 
> 
> {% csrf_token %}
> {{form|crispy}}
> 
> 
> 
> 
> {%endblock content%}
>
>
> the view:
>
> def chr_add_system_view(request):
> if request.method == 'POST':
> form = AddChrSystemForm(request.POST)
> if form.is_valid():
> print('add_system>valid')
> # TODO: do something
> return redirect(chr_systems_view)
> else:
> print('form.errors ' + str(form.errors))
> form = AddChrSystemForm()
> context = {'form': form}
> return render(request=request, 
> template_name='chr/add_system.html', context=context)
>
>
> the form:
>
> class AddSystemForm(ModelForm):
>
> def __init__(self, *args, **kwargs):
> super(AddSystemForm, self).__init__(*args, **kwargs)
> self.fields['profile_name'].widget.attrs['readonly'] = True
>
> class Meta:
> model = System
> fields = '__all__'
>
> def clean_system_id(self):
> print('validating oid of system..')
>
> system_id = self.cleaned_data['system_id']
> print('system_id: ' + system_id)
>
> if "2.16" not in system_id:
> print('oid of system id is invalid')
>
> raise forms.ValidationError(
> "Your submissionset source oid seems to be invalid. ==> it 
> has to be a valid oid and must start with: 2.16")
> print('oid of system id is valid')
> return system_id
>
>
> the button where the form is called:
>
> 
> SourceId
> 
> {% csrf_token %}
>  class="btn btn-warning btn-sm float-right" 
> value="{{item0}}">[WIP] Add System
> 
> 
> 
>
>
> my class
>
> class System(models.Model):
> system_id = models.CharField(max_length=100)
> abbreviation = models.CharField(max_length=100, default="SRC-")
> software_name = models.CharField(max_length=100, default="Portal")
> vendor = models.CharField(max_length=100, default="vendor")
> profile_name = models.CharField(max_length=100, default="Source")
>
>
>
>
>
>

-- 
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/e3874615-ee6d-43af-b2cb-3405038817c0%40googlegroups.com.


Re: How to trigger system check while running development server?

2020-02-28 Thread Naveen Arora
can you explain more with some code, the exact question .?

Cheers,
Naveen Arora

On Thursday, 27 February 2020 20:01:00 UTC+5:30, One Above All wrote:
>
> I am updating a settings in my test which should raise exception on 
> illegal entries, but merely updating settings does not make django perform 
> system checks. Is there any method which I can call to trigger those 
> checks? 
>

-- 
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/6f03d383-ba0a-4af8-b4b1-61b1b8b496cf%40googlegroups.com.


Re: Api

2020-02-28 Thread Naveen Arora
Create an API which returns count, then use javascript to update the front 
end part.


On Friday, 28 February 2020 12:50:39 UTC+5:30, Tosin Ayoola wrote:
>
> Good morning guyz,  
> I need help on this one,  it on writing api that will Shows the product 
> count for each manufacturer as users add products real time. 
> I have no idea how to solve this problem,  i will any suggestion 
> 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/cf4ed839-2cd7-4517-b3d1-b51b3c7a89ee%40googlegroups.com.


Re: Serializing forms and formsets to pass to Celery task

2020-02-28 Thread Naveen Arora
Hi Bernd,

You can't serialize a form data object this way.
All the solution i can see is to save data temporarily and use it.

Cheers,

On Friday, 28 February 2020 14:58:50 UTC+5:30, Bernd Wechner wrote:
>
> I'm using Celery quite effectively with Django as many are. It's just 
> awesome for running time consuming background tasks, and providing progress 
> bar updates to a web page. Love it.
>
> Now I would like a celery task to do some form processing. That is in a 
> Django view, where I have access to the form (or formset) that's just been 
> submitted, with all its data (in form.request.POST) and methods (like 
> form.save() which saves it to the database as a Django object or objects 
> (in the case of a formset). 
>
> Of course anything we pass to a Celery task must be serialized (as it's 
> passed through the broker) and there is plenty of help around on 
> serializing Django data objects but I can't find diddly squat on serialzing 
> forms and every effort I've tried, JSON, pickle, dill, all fails.
>
> I can serialize the POST data of course, and that great but I can't see 
> how the Celery task can then re-instantiate a form object from that.
>
> I posted this on stackoverflow as well with some richer detail: 
> https://stackoverflow.com/questions/60433090/processing-a-django-form-in-a-celery-task-how-can-the-celery-task-see-the-form
>
> I wonder if anyone has any experience to share here. Essentially I see two 
> possible solutions:
>
>1. Serialize the form or formsets somehow. Anything better than dill 
>out there that might?
>2. Serialize some part of the form or formsets (eg the POST data) and 
>re-instantiate a form or formset at the other end using it. 
>
> Either approach would work, 1. would seem less hassle if it has a 
> solution, and 2. seems more likely to provide one to me right now.
>
> Kind regards,
>
> Bernd.
>

-- 
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/7ea98dbe-ba20-4b74-bc0f-40f6babe52e1%40googlegroups.com.


Re: Make a cashier login in a system.

2020-02-28 Thread Naveen Arora
Hi,

Check this out - https://docs.djangoproject.com/en/3.0/topics/auth/

Cheers

On Friday, 28 February 2020 16:04:53 UTC+5:30, Kushal Neupane wrote:
>
>
> *I made a Cashier model and added some values from the admin. Now, i need 
> an idea to login the system from the Cashier model. I am confused on this 
> topic since 6 days.*
>

-- 
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/5a988806-73d6-4242-8c10-778d757f0a46%40googlegroups.com.


Re: Login in a system

2020-02-28 Thread Naveen Arora
Hi Kushal, 

Explain the problem clearly

Thanks


On Friday, 28 February 2020 16:04:53 UTC+5:30, Kushal Neupane wrote:
>
> How to make five post officer in an office and authonticate?
>

-- 
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/8a409e8e-ddc4-4f6c-9a4b-ffa7c2d987d7%40googlegroups.com.


Re: Image Upload

2020-02-28 Thread Naveen Arora
Hi, 
Have a look herer - 
https://www.techiediaries.com/django-rest-image-file-upload-tutorial/
and
https://stackoverflow.com/questions/20473572/django-rest-framework-file-upload

Cheers


On Friday, 28 February 2020 17:05:28 UTC+5:30, Soumen Khatua wrote:
>
> Hi Folks,
>
> I'm using DRF APIView to upload images, but I don't know how to write a 
> POST request to accept image. Please advise me how I can do it?
>
> my *serializers.py*
>
>
>
>
>
>
>
>
> *class ImageSerializer(serializers.ModelSerializer):class Meta:
> model = Profilefields = ['user','profile_pic']extra_kwargs 
> = {'user': {'write_only': True}}*
>
> My models.py contain profile_pic as a ImageField.
>
>
> Thank you in advance
>
>
> Regards,
> soumen
>

-- 
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/bde0c9db-ad47-4808-ab20-4d0b06d16a37%40googlegroups.com.


Re: Project directory management

2020-02-28 Thread Naveen Arora
Hi,

from .. import abc is not working ?
or somewhat like that.

At last sys.path.append() is one of the solutions.

Cheers,
Naveen Arora


On Friday, 28 February 2020 16:38:15 UTC+5:30, Devender Kumar wrote:
>
> Hi,
> BTW it is flask app question.
>
> dir structure 
>  service 
>  config/__init__.py
> config/config.py
> src/app.py
> src/__init__.py
>
> Running the flask app by writing command python src/app.py
>
> Question: I want to access config parameter in flask app from config 
> module of config package how can do that. 
>
> *solutions I tried* write *sys.path.append(''../")*  to my 
> src/__init__.py file but its not working please help me write this right 
> way.
>
> seems src/__init__.py is not being called.
>
> I don't want to change my dir structure and I don't want to write 
> *sys.path.append(''../")* in my app.py file, 
>
> 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/83d12e3d-f5c3-4bd2-8e7f-a8b69b12afdc%40googlegroups.com.


Re: Is it possible to extend the model in another application without explicitly changing firs-one?

2020-02-28 Thread Naveen Arora
What are you trying to achieve with this implementation?
and What do you call a extended model ?
Instance of model1 is accesible in app2, this already means you got your 
model1 in app2.

Curious.


On Friday, 28 February 2020 18:20:12 UTC+5:30, Ol P wrote:
>
> But how to add fields to it?
>
> Where to put what:
> from appA import model1
>
>
> class ExtendedModel1(?):
> ?
>
> new_field = models.CharFiled()
>
> class Meta:
>?
>
>
> On Friday, February 28, 2020 at 2:23:17 PM UTC+2, Naveen Arora wrote:
>>
>> Clearly Possible, 
>> Simply import the model first using appname.models. Hope it helps:)
>> You can use this as
>> from appA import model1
>> in app2
>>
>> On Thursday, 27 February 2020 22:04:12 UTC+5:30, Ol P wrote:
>>>
>>> Imagen we have *app-A* and *app-B* with *model-A* and *model-B* 
>>> accordingly.
>>> And we want to extend *model-A* in *app-B*.
>>> What should be written in *model-B* to implement it?
>>>
>>> In other words, is it possible to implement the same-table extension?
>>>
>>

-- 
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/13cffa42-fc48-4b2c-9ecd-787878c42031%40googlegroups.com.


Re: production setup

2020-02-28 Thread Naveen Arora
Try implementing it for once. If you face any problem, you can post in this 
community

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/bb5983e0-d829-47e4-a28d-196e50297cff%40googlegroups.com.


production setup

2020-02-28 Thread Naveen Arora
Hi 

have a look at this - 
https://github.com/codingforentrepreneurs/Guides/blob/master/all/Heroku_Django_Deployment_Guide.md

Cheers

-- 
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/62ca806f-a7ef-4124-af65-f6fb775448d6%40googlegroups.com.


Re: Issue in the API while merging the two data frames

2020-02-29 Thread Naveen Arora
Hi Devendra , 
Can you share the code with the exact error you are facing.?

Cheers,
Naveen Arora


On Saturday, 29 February 2020 04:35:02 UTC+5:30, Devendra reddy wrote:
>
> Hi to all,
>
> I have two data frames in the python django API.one dataframe we are 
> getting from the query and one data frame we are getting the XL file.how I 
> want map this dataframes.in this equipment name and tag name are 
> common.while merging one tag is missing or it is going to be updated with 
> another tag in that dataframe repetition is happening.while giving 
> conditions like how = right or left or inner or outer the tag is missing 
> and this tag is going to update by the another tag and this tag is coming 
> as twice. How can I solve this?
> Please suggest me solution.
>
> Thanks and 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/81e11358-b252-4616-b6f9-118deefd537e%40googlegroups.com.


Re: Api

2020-02-29 Thread Naveen Arora
Can you share the traceback of error you are facing ?

Cheers,

On Saturday, 29 February 2020 11:17:59 UTC+5:30, Tosin Ayoola wrote:
>
> halo having 2 issues now 
> (1st) getting an integrity err 
> (2nd) i have a api code that return's count but still i'm not getting wat 
> i expected 
> below is my codes and the err msg i'm getting 
>
> ###APIView 
>
> class CartViewSet(viewsets.ModelViewSet):
> serializer_class = CartDetailSerializer
> queryset = CartList.objects.all()
>
>
> #@detail_route(methods=['post', 'put'])
> def add_item(request, self, pk=None):
> cart = self.get_object()
> try:
> product = Product.objects.get(
> pk = request.data['product_id']
> )
> quantity = int(request.data['quantity'])
> except Exception as e:
> print (e)
> return Response({'status': 'fail' })
>
> if product.quantity < 0 or product.quantity - quantity < 0:
> print('sorry check back leta')
> return Response({'status': 'fail'})
>
>  existing_cart = CartList.objects.filter(product=product,   
> cart=cart).first()
> if existing_cart:
> existing_cart.quantity +=quantity
> existing_cart.save()
> else:
> new_cart = CartList(cart=cart, product=product,   
>   quantity=quantity)
> new_cart.save()
> product_list =  
> Product.Objects.filter(manufacturer=manufacturer).count()
> serializer = CartSerializer(cart)
> return Response(serializer.data)
>
> Serializer 
>
> class CartDetailSerializer(serializers.ModelSerializer):
> customer = UserSerializer(read_only =True)
> items = serializers.StringRelatedField(many=True)
>
> class Meta:
> model = CartList
> fields = ('id', 'customer', 'items', 'created', 'updated')
>
> class CartListSerializer(serializers.ModelSerializer):
> class Meta:
> model = CartList
> fields = ('product', 'quantity')
>
>
> On Fri, Feb 28, 2020 at 1:28 PM Naveen Arora  > wrote:
>
>> Create an API which returns count, then use javascript to update the 
>> front end part.
>>
>>
>> On Friday, 28 February 2020 12:50:39 UTC+5:30, Tosin Ayoola wrote:
>>>
>>> Good morning guyz,  
>>> I need help on this one,  it on writing api that will Shows the product 
>>> count for each manufacturer as users add products real time. 
>>> I have no idea how to solve this problem,  i will any suggestion 
>>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/cf4ed839-2cd7-4517-b3d1-b51b3c7a89ee%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/cf4ed839-2cd7-4517-b3d1-b51b3c7a89ee%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

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


Re: Is it possible to extend the model in another application without explicitly changing firs-one?

2020-02-29 Thread Naveen Arora
Hi again,

According to what i have understood the problem till now. You are trying to 
implement it the wrong way. This is not python, Everything is already built 
using classes, you are already overriding a class, then extending an 
overriden class seems complicated. Modularity and loose coupling can be 
achieved through a completely different way here. Be it clear, a model 
creates a table in the database. Why are you trying to create the same 
table again and again with more or less attributes ? 
Try implementing manytomany fields, foreign =key etc. This may solve your 
problem .

Regards
Naveen Arora

On Friday, 28 February 2020 18:33:20 UTC+5:30, Ol P wrote:
>
> What are you trying to achieve with this implementation?
>
> I want to achieve modularly and loose coupling. Separate responsibility in 
> other words.
>
> and What do you call a extended model ?
>
> By extended model, I mean pat of an existing model, that implemented in 
> one place (in out example app-A) but extended, altered or modified in 
> another please (in out example app-B)
>
> Instance of model1 is accesible in app2, this already means you got your 
>> model1 in app2.
>
> Yes, but not the model itself.
>
> On Friday, February 28, 2020 at 2:53:45 PM UTC+2, Naveen Arora wrote:
>>
>> What are you trying to achieve with this implementation?
>> and What do you call a extended model ?
>> Instance of model1 is accesible in app2, this already means you got your 
>> model1 in app2.
>>
>> Curious.
>>
>>
>> On Friday, 28 February 2020 18:20:12 UTC+5:30, Ol P wrote:
>>>
>>> But how to add fields to it?
>>>
>>> Where to put what:
>>> from appA import model1
>>>
>>>
>>> class ExtendedModel1(?):
>>> ?
>>>
>>> new_field = models.CharFiled()
>>>
>>> class Meta:
>>>?
>>>
>>>
>>> On Friday, February 28, 2020 at 2:23:17 PM UTC+2, Naveen Arora wrote:
>>>>
>>>> Clearly Possible, 
>>>> Simply import the model first using appname.models. Hope it helps:)
>>>> You can use this as
>>>> from appA import model1
>>>> in app2
>>>>
>>>> On Thursday, 27 February 2020 22:04:12 UTC+5:30, Ol P wrote:
>>>>>
>>>>> Imagen we have *app-A* and *app-B* with *model-A* and *model-B* 
>>>>> accordingly.
>>>>> And we want to extend *model-A* in *app-B*.
>>>>> What should be written in *model-B* to implement it?
>>>>>
>>>>> In other words, is it possible to implement the same-table extension?
>>>>>
>>>>

-- 
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/6b06949d-0362-4ea4-af7e-18678348e7f7%40googlegroups.com.


Re: Serializing forms and formsets to pass to Celery task

2020-02-29 Thread Naveen Arora
Yes that would work well. You can always find a completely different way of 
achieving what you are trying to achieve.

On Saturday, 29 February 2020 18:52:24 UTC+5:30, Jason wrote:
>
> As said before, you really can't do that too well with celery.  Its a good 
> practice to keep the message body between django -> broker -> worker to be 
> as small as possible because we don't know what your configuration for the 
> broker is.  In addition, you should never, ever, put sensitive information 
> in a message, just the identifier of a thing and let celery/django pull 
> from a data store when the task starts.
>
> what I would do is save the form data to some intermediate data store, and 
> pass in the identifier to the celery task for retrieval.  That ensures your 
> data integrity and security is high.
>

-- 
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/3f1b4374-ca68-4fcd-a33a-555bc72cbae8%40googlegroups.com.


Re: display data

2020-03-03 Thread Naveen Arora
Hi,

Can you explain what you are trying to achieve clearly.?

Regards
Naveen Arora

On Sunday, 1 March 2020 19:06:02 UTC+5:30, Perceval Maturure wrote:
>
> Hi Team
> is there anyone who has tried to display data from a table to six 
> different cards, when another record is added the first initialy is 
> replaced ?
> regards
>
>
> -- 
> *Perceval Maturure*
>
> *083 303 9423*
>

-- 
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/0299d7d7-13f2-49a5-859f-4b3343f88625%40googlegroups.com.


Re: Error while adding entries through django admin

2020-03-03 Thread Naveen Arora
Hi,

First, it would be easy t debug if you share entire traceback + one 
solution would be to run makemigrations and migrations again :)

Did you override any default template from the codebase ?

Regards
Naveen Arora

On Monday, 2 March 2020 16:34:03 UTC+5:30, Santhosh sridhar wrote:
>
> Hi,
> I have registered a model in my django admin page. When I click the Add 
> link, it throws me this error, Invalid block tag: 
> 'change_list_object_tools', expected 'endblock'
>
> *django.template.base.TemplateSyntaxError: . I could not get any solution. 
> Appreciating someone's help.*
>
>
> *Regards,*
>
> *Santhosh*
>

-- 
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/d71918a8-9170-406f-9985-9651b4eaa46c%40googlegroups.com.


Re: How to create multipage forms with different models

2020-03-03 Thread Naveen Arora
Hi,

What problem you are facing ? A form can be sent to any template using its 
object and context dictionary. "Split the form to separate templates" ? 
This seems unusual, create different forms if you want to use more 
templates. 

Cheers :)
Naveen Arora

On Monday, 2 March 2020 18:08:44 UTC+5:30, victor awakan wrote:
>
> I am a building a small project in Django. I am able to create two or more 
> forms in a template but now, I want to split the form to separate templates 
> with each form belong to different models. How can I achieve this? Here is 
> a link to dpaste with the multiple forms in a template I created: 
> http://dpaste.com/1WX0RC8
>
> All help and suggestions will be appreciated.
> PS. I have tried it with formtools and it worked. I am trying to learn how 
> to do the same thing with function based views. 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/bcc340d9-a70b-449c-825b-4819969c35d1%40googlegroups.com.


Re: new to django

2020-03-03 Thread Naveen Arora
Hi, 

Have a look at my tutorials :)

https://www.geeksforgeeks.org/django-tutorial/

Cheers,
Naveen Arora

On Sunday, 1 March 2020 23:34:45 UTC+5:30, Gurjot Kawatra wrote:
>
> hello everyone ...if anybody could help me out
> my django server is started and i'm able to see congratulation messege...
> now plz tell me the next step to create a project and run and watching 
> output at the localhost:8000
>

-- 
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/68101164-382b-4f2e-96a8-0fc17682de62%40googlegroups.com.


Re: The field admin.LogEntry.user was declared with a lazy reference to 'account.user', but app 'account' doesn't provide model 'user'

2020-03-03 Thread Naveen Arora
If you are interfering with USER model, note that you have to change the 
deafult model to first migration only.
Solution - Delete the migrations folder, run makemigrations and migrate 
again. Also, if you are overriding any model, must define it in settings.py.

Regards
Naveen Arora

On Monday, 2 March 2020 18:09:14 UTC+5:30, sagar ninave wrote:
>
>

-- 
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/a53b93cc-2dd0-46a6-9887-f10b8cdadb91%40googlegroups.com.


Re: AttributeError: 'NoneType' object has no attribute 'app_name'

2020-03-03 Thread Naveen Arora
Hi, 

Can't the error be resolved ? Still, if error has to occur then you can put 
conditions instead of try blocks for better functioning.

Regards
Naveen Arora


On Monday, 2 March 2020 18:25:15 UTC+5:30, Sencer Hamarat wrote:
>
> Hello, 
>
> The project I'm working on has it's custom template context_processor.
> And when unavailable URL request arrives to Django (Eg. "/wp-login.php"), 
> the context_processor is throwing AttributeError.
>
> Which way should I use to prevent from context processor from throwing 
> errors?
> Is it ok to wrapping return with try block and returning empty dictionary 
> if AttributeError raised?
>
> def resolver_context_processor(request):
> return {
> 'app_name': request.resolver_match.app_name,
> 'namespace': request.resolver_match.namespace,
> 'url_name': request.resolver_match.url_name
> }
>
>
>
>

-- 
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/77b25608-b663-440c-977c-4fedfd808c8c%40googlegroups.com.


Re: Django Platform (not just Framework)

2020-03-03 Thread Naveen Arora
Hi,

What plugins you would want to install ? if you are talking about pip 
packages, you can use pycharm wrapper for the same. pycharm allows to 
download pip packages using GUI.

Cheers
Naveen Arora


On Monday, 2 March 2020 21:24:32 UTC+5:30, guettli wrote:
>
> I know the terms "Platform" and "Framework" are not well-defined.
>
> For me a platform allows you to install plugins without touching source 
> code.
>
> For example, Nextcloud is a platform (for me).
>
> Is there already a third-party solution that provides a platform based on 
> Django?
>
> This would be very very cool.
>
> Regards,
>   Thomas Güttler
>

-- 
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/9266bb40-6ecb-4fd9-8709-678d5cd875e1%40googlegroups.com.


Re: NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Naveen Arora
Try passing a relative path, as the error itself says, absolute path not 
supported.

Thanks

On Tuesday, 3 March 2020 13:46:11 UTC+5:30, Soumen Khatua wrote:
>
> Hi Folks,
>
> I'm using AWS S3 Bucket to store media folder(images) but I want to resize 
> each every image in 300*300. So, I'm overriding the save method inside 
> django model class. But I'm getting one error caled:
> *   NotImplementedError: This backend doesn't support absolute paths.*
>
> *My django models look like:*
>
> * class Profile(models.Model):*
>
>
>
>
>
>
>
>
>
>
>
>
>
> *user = models.OneToOneField(AUTH_USER_MODEL,
> on_delete=models.CASCADE,related_name="profile")profile_pic 
> = models.ImageField(default = 'profile.jpg',upload_to = 
> user_directory_path, null = True)def save(self, *args, **kwargs):  
>   super().save(*args, **kwargs)img = 
> Image.open(self.profile_pic.path)if img.height > 300 or img.width > 
> 300:output_size = (300, 300)
> img.thumbnail(output_size)img.save(self.image.path)*
>
>
>
> I don't know how to solve this issue.
>
> Thank you in advance
>
> Regards,
> soumen
>

-- 
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/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com.


Re: How to create multipage forms with different models

2020-03-03 Thread Naveen Arora
Each form field has an id to be identified at back end. So just select the 
relevant field create a model object using the same and save it.
Similarly do for the other.

You can try for once share the code here if you are unsuccessfull, i will 
help you with the code part then.

Cheers


On Tuesday, 3 March 2020 14:58:05 UTC+5:30, victor awakan wrote:
>
> What I meant was I want one form to be saved in one model and the second 
> form to be saved in another model. I did that using form-tools but I want 
> to learn how to do it using function based views. Thanks.
>
> On Tuesday, March 3, 2020 at 11:19:40 AM UTC+2, Naveen Arora wrote:
>>
>> Hi,
>> 
>> What problem you are facing ? A form can be sent to any template using 
>> its object and context dictionary. "Split the form to separate templates" 
>> ? This seems unusual, create different forms if you want to use more 
>> templates. 
>>
>> Cheers :)
>> Naveen Arora
>> 
>> On Monday, 2 March 2020 18:08:44 UTC+5:30, victor awakan wrote:
>>>
>>> I am a building a small project in Django. I am able to create two or 
>>> more forms in a template but now, I want to split the form to separate 
>>> templates with each form belong to different models. How can I achieve 
>>> this? Here is a link to dpaste with the multiple forms in a template I 
>>> created: http://dpaste.com/1WX0RC8
>>>
>>> All help and suggestions will be appreciated.
>>> PS. I have tried it with formtools and it worked. I am trying to learn 
>>> how to do the same thing with function based views. 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/78b2905b-9864-4b5e-aff8-79c5fbedcff9%40googlegroups.com.


Re: NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Naveen Arora
Can you share the complete traceback of error + what are you passing and 
where so that i can understand the flow. ?

Cheers

On Tuesday, 3 March 2020 19:15:56 UTC+5:30, Soumen Khatua wrote:
>
> after changing the path still I'm getting the same type of error.
>
> Thank you for your response.
>
>
> On Tue, Mar 3, 2020 at 3:01 PM Naveen Arora  > wrote:
>
>> Try passing a relative path, as the error itself says, absolute path not 
>> supported.
>>
>> Thanks
>>
>> On Tuesday, 3 March 2020 13:46:11 UTC+5:30, Soumen Khatua wrote:
>>>
>>> Hi Folks,
>>>
>>> I'm using AWS S3 Bucket to store media folder(images) but I want to 
>>> resize each every image in 300*300. So, I'm overriding the save method 
>>> inside django model class. But I'm getting one error caled:
>>> *   NotImplementedError: This backend doesn't support absolute paths.*
>>>
>>> *My django models look like:*
>>>
>>> * class Profile(models.Model):*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *user = models.OneToOneField(AUTH_USER_MODEL,
>>> on_delete=models.CASCADE,related_name="profile")profile_pic 
>>> = models.ImageField(default = 'profile.jpg',upload_to = 
>>> user_directory_path, null = True)def save(self, *args, **kwargs):  
>>>   super().save(*args, **kwargs)img = 
>>> Image.open(self.profile_pic.path)if img.height > 300 or img.width > 
>>> 300:output_size = (300, 300)
>>> img.thumbnail(output_size)img.save(self.image.path)*
>>>
>>>
>>>
>>> I don't know how to solve this issue.
>>>
>>> Thank you in advance
>>>
>>> Regards,
>>> soumen
>>>
>> -- 
>> 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/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

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


Re: display data

2020-03-03 Thread Naveen Arora
So you want to display data from this model to six cards, but how..i mean 
each row can be said as "one data" so you want to display 6 rows of this 
table basically on 6 rows. Another question is how you want to filter the 
data, first 6 rows according to date, etc. ?

if you want to display first 6 responses of .all(), you can easily do it 
using " [ 0 : 6 ] "
  
On Tuesday, 3 March 2020 15:31:10 UTC+5:30, Perceval Maturure wrote:
>
> Hi Naveena
>
> I have a model below
>
> I  I want to display records in the db on six cards as the end date is 
> past then the record is removed from the list. I tried to use indexes but 
> it dint work as epxected
> Any ideas would be awesome to share
>
> On 3 Mar 2020, at 11:13, Naveen Arora > 
> wrote:
>
> Hi,
>
> Can you explain what you are trying to achieve clearly.?
>
> Regards
> Naveen Arora
>
> On Sunday, 1 March 2020 19:06:02 UTC+5:30, Perceval Maturure wrote:
>>
>> Hi Team
>> is there anyone who has tried to display data from a table to six 
>> different cards, when another record is added the first initialy is 
>> replaced ?
>> regards
>>
>>
>> -- 
>> *Perceval Maturure*
>>
>> *083 303 9423*
>>
>
> -- 
> 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/0299d7d7-13f2-49a5-859f-4b3343f88625%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/0299d7d7-13f2-49a5-859f-4b3343f88625%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/60242ac5-070a-4a61-8ca9-5478a218f7e7%40googlegroups.com.


Re: Django s3 video files displaying to templates

2020-03-11 Thread Naveen Arora
Hi irfan, 
you can have a look here - 
https://github.com/codingforentrepreneurs/Guides/blob/master/all/Heroku_Django_Deployment_Guide.md#setup-static-files

On Thursday, 12 March 2020 10:58:05 UTC+5:30, Irfan Khan wrote:
>
> Hi all,
>
> Can any one guide me how to display uploaded video files in S3 to django 
> templates.
>
> Thanks in advance for your help
>

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


Re: { "non_field_errors": [ "No data provided" ] } error during a post method.

2020-03-11 Thread Naveen Arora
Hi try debugging it by printing data, where this error is occuring and then 
you will be able to correct it.

Cheers


On Saturday, 11 May 2019 18:05:24 UTC+5:30, Arun Kumar Singamasetty wrote:
>
>
> ##from file serilaizers.py###
>
>
> from rest_framework import serializers
> from .models import Article
>
> # class ArticleSerializer(serializers.Serializer):
> # title = serializers.CharField(max_length=120)
> # description = serializers.CharField()
> # body = serializers.CharField()
> # author_id = serializers.IntegerField()
>
> class ArticleSerializer(serializers.ModelSerializer):
> class Meta:
> model = Article
> fields = ('title', 'description', 'body', 'author_id')
>
> def create(self, validated_data):
> return Article.objects.create(**validated_data)
>
> # class UserSerializer(serializers.HyperlinkedModelSerializer):
>
>
>
>
>
>
> #from file models.py##
>
>
> # from django.db import models
>
> # Create your models here.
> from django.db import models
>
> class Author(models.Model):
>   name = models.CharField(max_length=255)
>   email = models.EmailField()
>
>
> class Article(models.Model):
> title = models.CharField(max_length=120)
> description = models.TextField()
> body = models.TextField()
> author = models.ForeignKey('Author',on_delete=models.CASCADE,)
>
> def __str__(self):
> return self.title
>
>
>

-- 
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/338e8209-1808-4121-85be-c9fbfe4886bc%40googlegroups.com.


Re: how i can dynamically select page orproduct on form django

2020-03-11 Thread Naveen Arora
Hi, 

Can you be more specific about what you want to achieve, you want to save 
form with foreign key value ?
Are you taking input for foreign key id or something ?


Cheers 

On Thursday, 12 March 2020 03:24:07 UTC+5:30, abderrahim ariche wrote:
>
>
>
> hello i guys i want save form with foreignkey thee value what i want on 
> this foreign key the id of the product page the form has filled  and this 
> task need to be hidden like the value of of the form is page id 
>
> like this flow:
>
> the product_id= 'value of current page id' 
>
> and i think i need to use __init__ on form.py as filter and i not 
> understand what this really work i try but no result thanks for attention I 
> appreciate your answers 
>
> thank you
>
>
> other field = no problem on this work great
> form = Modelform(request.POST)
>
>  Modelform.Product.filter(id=p_id)
>  if form.is_valid():
>  post = form.save(commit=False)
>
>  #p_id =Product.objects.filter( id=p_id)
>  #Modelform(initial={'p_id':p_id})
>  post.save()
>  form = Modelform()
>
> the models:
> from django.db import models
>  class Product(models.Model):
>   title = models.CharField(max_length=50 , default='product title')
>   price = models.CharField(max_length=10 , default= int('0'))
>   delPrice = models.CharField(max_length=10, default=int('0'))
>   img1 = models.ImageField(upload_to='product_gallry',default='img') 
>   img2 = models.ImageField(upload_to='product_gallry',default='img') 
>   img3 = models.ImageField(upload_to='product_gallry',default='img')
>   description = models.TextField(max_length=5000 , default='description')
>   Video_Link = models.TextField(max_length=5000 , default='Video_Link')
>  def __unicode__(self): 
>return u'%d' % self.id 
> class Form (models.Model):
>  Product = models.ForeignKey(Product,null=True, 
> blank=True,on_delete=models.SET_NULL)
>  name = models.CharField(max_length= 100 , default=None) 
>  number = models.CharField(max_length=13,default=None) 
>  adresse = models.CharField(max_length=500,default=None) 
>  city = models.CharField(max_length=20, default=None)
>
>
>
>
> the views:
>
> from .form import Modelform
> from .models import Product, Form 
> from django.shortcuts import render 
> from django.shortcuts import get_object_or_404 
> from django.utils import timezone
>   def p_page(request,p_id): obj = Product.objects.all()
>  template = "index.html"
>  product = get_object_or_404(obj,id=p_id)
>  if request.method =='POST': 
>form = Modelform(request.POST)
>Modelform.Product.filter(id=p_id)
>if form.is_valid():
>   post = form.save(commit=False)
>   #p_id =Product.objects.filter( id=p_id)
>   #Modelform(initial={'p_id':p_id})
>   post.save()
> form = Modelform() 
> context = { 'form': form, 'product': product, }
> return render(request,template, context,)
> the form.py:
>
> from django import forms 
> from . import models
>  from .models import Product
>   class Modelform(forms.ModelForm):
> Product = forms.ModelChoiceField(queryset=Product.objects.all(), ) 
> name = forms.CharField(max_length=100,
> widget=forms.TextInput( attrs={ 'style': ' height: 20%; 
> display: inline-block; width: 80%; text-align: center; font-size: 30px; 
> margin: 7px 2.5%; float: right; background: white; color: #c50d2c;', 
> 'placeholder': 'Write your name here' } ) )
> number = forms.CharField(max_length=13, 
>widget=forms.TextInput( attrs={ 'style': ' height: 20%; 
> display: inline-block; width: 80%; text-align: center; font-size: 30px; 
> margin: 7px 2.5%; float: right; background: white; color: #c50d2c;', 
> 'placeholder': 'Write your name here' } ) ) 
> adresse = forms.CharField(max_length=500,
>  widget=forms.TextInput( attrs={ 'style': ' height: 20%; 
> display: inline-block; width: 80%; text-align: center; font-size: 30px; 
> margin: 7px 2.5%; float: right; background: white; color: #c50d2c;', 
> 'placeholder': 'Write your name here' } ) )
> city = forms.CharField(max_length=20, widget=forms.TextInput( attrs={ 
> 'style': ' height: 20%; display: inline-block; width: 80%; text-align: 
> center; font-size: 30px; margin: 7px 2.5%; float: right; background: white; 
> color: #c50d2c;', 'placeholder': 'Write your name here' } ) )
> class Meta:
>model = models.Form
>   fields = ['name','number','adresse','city','Product']
>
>

-- 
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/539cd2ad-d647-4891-a1ad-f0280c543de5%40googlegroups.com.


Re: Cant collecstatic with STATICFILES_FINDERS

2020-03-11 Thread Naveen Arora
did you run collectstatic command ?

On Wednesday, 11 March 2020 19:24:07 UTC+5:30, Florent Vandroy wrote:
>
> Hi all. I dont understand why. But I Have to remove my STATICFILES_FINDERS 
> line from my settings before collecstatic or its notre working. 
>
> STATICFILES_FINDERS = [ 
> 'compressor.finders.CompressorFinder', 
> ] 
>
> Here is my static file finder parameter. I didnt use compressor anymore on 
> my project so I Have uninstalled him. But if I remove this line. The css is 
> not found on my website 
>
> GitHub project if you Need it : 
> https://github.com/florent6001/django-simple-blog/blob/master/main/settings.py
>  
>
> Thank you all

-- 
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/2f018efe-f723-4c86-b82f-d23a7c9dc683%40googlegroups.com.


Re: Mentor needed

2020-03-11 Thread Naveen Arora
Well, me too :)


On Wednesday, 11 March 2020 15:39:20 UTC+5:30, ola neat wrote:
>
> Hey guyz I'm applying  for GSOC {django} & i pretty much need help 
> (mentors),   
>

-- 
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/6722adc0-5cb9-4364-acbc-b4dff20b4873%40googlegroups.com.


Re: PostgreSQL data transfering

2020-03-11 Thread Naveen Arora
Please be more specific about your question.
As far i could understand by now, you need to check how your models are 
related and then you can easily normalize them into as many models as 
possible.

Cheers


On Wednesday, 11 March 2020 15:29:32 UTC+5:30, Eldar Yerzhanov wrote:
>
> Hello, I have this kind of problem. We have designed two applications with 
> different models. Now we should divide these applications into three apps 
> by dividing all information inside them into 3 models. What kind of method 
> or technique I can use to apply it.
>

-- 
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/dcf187d7-5836-48d9-b939-635046997fbf%40googlegroups.com.


Re: How to resolve account access permission on SendGrid.

2020-03-11 Thread Naveen Arora
wrong portal to ask this question :)


On Wednesday, 11 March 2020 00:09:31 UTC+5:30, avinash prajapati wrote:
>
> I am recently created an account on SendGrid but after first login it is 
> showing 
> error that accounts access permission is not authonaticate.
> Help to resolve this issue..
>

-- 
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/601e6dc0-48d9-4f89-89e1-7498a1a96255%40googlegroups.com.


Re: example django rest swagger app done beautifly

2020-03-11 Thread Naveen Arora
Noiceee ..!!

On Wednesday, 11 March 2020 05:46:29 UTC+5:30, Jan Filips wrote:
>
> https://github.com/janfilips/django-rest-beautifly
>
> pls star if you like!  :)
>

-- 
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/650aaf07-f350-41c8-b6a8-ef7a1c0dfcb4%40googlegroups.com.


Re: HELP ME

2020-03-11 Thread Naveen Arora
Hi,

This might help you - Django Tutorials 


Cheers


On Tuesday, 10 March 2020 20:05:06 UTC+5:30, LGBS fine soul coders wrote:
>
> hello am lugano mwakapuku from tanzania i'm a bigginer in django please i 
> need your help guy
>
>

-- 
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/7796068d-8868-4707-a6b3-b96b4527674b%40googlegroups.com.


Re: unable to read POST parameters sent by payment gateway

2020-03-11 Thread Naveen Arora
There is something wrong with URL, you are pushing, try using some other 
url, append slash, etc.
That may help you :)

Cheers

On Tuesday, 10 March 2020 01:53:24 UTC+5:30, Sreekanth wrote:
>
> I am unable to read POST parameters sent by payment gateway after payment 
> was processed. Payment gateway redirects to returnUrl (I pass this to 
> payment gateway before payment was processed) with some parameters by POST 
> request.
>
> In url.py
>
> path('cashfreeresponse/',views.cashfree_response, name='cashfree_response'),
>
> in views.py
>
> @csrf_exempt@login_requireddef cashfree_response(request):
> print(request.method)
> if request.method == "POST":
> print('inside post method')
> print(request.POST.get('cf_subReferenceId'))
> if request.method == "GET":
> print('inside get method')
> print(request.GET.get('cf_subReferenceId'))
>
> print(request.method) is showing as GET but it was supposed be POST method 
> also print(request.GET.get('cf_subReferenceId')) and 
> print(request.POST.get('cf_subReferenceId')) are showing as None.
>
> But it looks like payment gateway sending parameters as POST method. When 
> I pass returnUrl as http://127.0.0.1:8000/cashfreeresponse instead of 
> http://127.0.0.1:8000/cashfreeresponse/ ('/' is missing in the first one) 
> then I am getting error as
>
> You called this URL via POST, but the URL doesn't end in a slash and you 
> have APPEND_SLASH set. Django can't redirect to the slash URL while 
> maintaining POST data. Change your form to point to 
> 127.0.0.1:8000/cashfreeresponse/ (note the trailing slash), or set 
> APPEND_SLASH=False in your Django settings.
>
> but I see in my google chrome page that payment gateway sending parameters 
> with POST request. Below image shows parameters sent by payment gateway by 
> POST request
>
> [image: enter image description here] 
> 
>
> If I change urls.py to
>
> path('cashfreeresponse',views.cashfree_response, name='cashfree_response'),
>
> in settings.py to
>
> APPEND_SLASH = False
>
> and returnUrl to http://127.0.0.1:8000/cashfreeresponse then I am not 
> getting any error but still not receiving any parameters. How do I read 
> those parameters sent by payment gateway by POST request? Here 
>  is the 
> documentation for payment gateway.
>

-- 
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/48da7caa-f76d-47d2-8283-67fe5a0fcbda%40googlegroups.com.