Re: Adding stored procedures

2018-04-19 Thread Larry Martell
There are django-mssql and django_pyodbc but I was never able to get
either of those to work for me. I ended up using odbc - I couldn't use
the ORM, but I still was able to connect to the MSSQL DB from my
django app using raw queries.

On Wed, Apr 18, 2018 at 8:55 AM, Matthew Pava  wrote:
> Hi Chris,
>
> SQL Server is not one of the databases that Django supports out of the box.
> There are third party packages available, though, but I haven’t tested any
> of them with recent versions.
>
> Saying that, you can create views in your database backend.  In your
> migrations file, use the RunSQL operation.
>
> https://docs.djangoproject.com/en/2.0/ref/migration-operations/#runsql
>
>
>
> In your models file, change the Meta option, managed, to False.
>
> https://docs.djangoproject.com/en/2.0/ref/models/options/#managed
>
>
>
> Good luck!
>
>
>
> As for stored procedures and functions, I haven’t worked enough with those
> mixed in with Django to give you much guidance except to do some more
> searching on the web.  And I would also advise against using them so that
> you can keep your code in your Django project.  I haven’t found a need for
> them myself while using Django.
>
>
>
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> On Behalf Of Chris Wedgwood
> Sent: Wednesday, April 18, 2018 1:50 AM
> To: django-users@googlegroups.com
> Subject: Adding stored procedures
>
>
>
> Hi All
>
>
>
> I am using SQL SERVER in my latest django project and I am going to be using
> some stored procedures.
>
>
>
> My question is about how to go about deploying stored procedure changes with
> django. I have looked through the migrations documentation which looks very
> specific to model changes.
>
>
>
> Has anyone had experience of having to create other things such a stored
> procedures/views/functions?
>
>
>
> thanks
>
> Chris
>
>
>
>
>
>
>
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACQBJYU5CDhCrP7cNRpzp7fRDr1pyf48css-EaVW%3Drj65SmEsg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/58f5f935832647b0afd58ac5105b45f0%40ISS1.ISS.LOCAL.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY4OOb3HufKYQ8v2y5cUGgVWmhzBTMgO6hn%2BEO%3Dwi9swww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: perhap buys in autodetector.py

2018-04-19 Thread Zheng Gu
Yes, you are right, I removed all migrations folder, include any files in
it(such as 0001_initial.py), and as you said, I have to run "makemigrations
app_name" to generate new codes. To avoid these tedious work, I made a
change: [questioner.py:42] return self.defaults.get("ask_initial", False)
==> return self.defaults.get("ask_initial", True) when calling
makemigrations, and after created codes, change it back. I'm just not sure
if it is correct to change autodetector.py.


On Thu, Apr 19, 2018 at 10:02 PM, Tim Graham  wrote:

> When you say, "remove all previous migration codes" -- you mean you
> removed all the migration files such as 0001_initial.py? In that case, make
> sure you don't remove the __init__.py file, otherwise you must use
> "makemigrations app_name".
>
> On Thursday, April 19, 2018 at 7:18:02 AM UTC-4, guzheng2000 wrote:
>>
>> Hi,
>>
>> Django prompts "no changes..." when I want to re-create migration codes
>> by calling makemigrations after remove all previous migration codes. After
>> some digs, I found it can be fixed by changing:
>> [autodetector.py:151] "al not in self.from_state.real_apps " ==> "al not
>> in self.to_state.real_apps"
>>
>> Just let you guys know, I'm not sure it is correct.
>> thanks,
>> gz
>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/b0d0da83-2935-418f-85b8-433f0eac5cfc%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJ0YSGWh3MS0jUQzJnm1qRfsqpswm4EA6GixnxrWZPvp7DXqJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: username and allowed alphanumeric, why?

2018-04-19 Thread Melvyn Sopacua
On donderdag 12 april 2018 15:59:50 CEST Stefano Tranquillini wrote:
> My question was related why only that set of extrachars, adding a '=' is a
> dangerous step or not?
> Reading the rest of the page it seems that everyhing is supported with
> unicode.

Everything except non-printables and control characters ("the usual"). Adding 
a = poses no danger.

-- 
Melvyn Sopacua

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3507148.J6ofRUPWRp%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Error with channels and celery

2018-04-19 Thread Melvyn Sopacua
On woensdag 18 april 2018 10:05:23 CEST Sergio Lopez wrote:

> Mi error is:
> 
> raise OSError(err, 'Connect call failed %s' % (address,))
> ConnectionRefusedError: [Errno 10061] Connect call failed ('::1', 6379)

Somewhere you have configured the redis connection to [::1] (IPv6) or localhost 
(and your OS set to prefer IPv6).

> app.conf.update(
> BROKER_URL = 'redis://127.0.0.1:6379/0',)

But not there, apparently.
-- 
Melvyn Sopacua

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1623037.BnQq8s3X9k%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Authentication Django RestFramework

2018-04-19 Thread Musharaf Baig


There is not register/login mechanism for users.

I need two types of authentication:

   1. 
   
   To make it available I would like to let the user use it for free with a 
   limited number of call s or time 
   
- for example after the API is called 50 times, I would like that the token 
expires. An alternative solution is that  the token should expire in 2 
days. 

2) An authentication with a key that does not expire at all. 

Is this possible? Need suggestions. 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27c80056-e9c7-4375-998c-d5304a3d7c5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding stored procedures

2018-04-19 Thread Jani Tiainen
Hi.

Django migrations are run only once. If you want to change you stored
procedure you always need a new migration.

In case of being last migration you could develop it by having drop clause
im reverse migration. But if there is another migration(s) between current
and new stored procedure you need to create new migration.

One option could be to hook pre- or post migration signal and apply your
stored procedure there.


to 19. huhtikuuta 2018 klo 17.02 Chris Wedgwood 
kirjoitti:

> Thanks Matthew
>
> I probably need to think about this some more
>
> I think using runsql will work. Do you know if you can set migrations to
> be rerunnable? It would be useful to be able to change something like a
> stored procedure and then it gets dropped and recreated each deployment
>
> Saying that the stored procedure is going to be used for an import task
> that isn't actually related to Django so probably needs to be deployed  by
> another mechanism and I should leave migrations for only DJango specific
> changes
>
> thanks
> Chris
>
>
>
> On Wednesday, 18 April 2018 07:50:52 UTC+1, Chris Wedgwood wrote:
>>
>> Hi All
>>
>> I am using SQL SERVER in my latest django project and I am going to be
>> using some stored procedures.
>>
>> My question is about how to go about deploying stored procedure changes
>> with django. I have looked through the migrations documentation which looks
>> very specific to model changes.
>>
>> Has anyone had experience of having to create other things such a stored
>> procedures/views/functions?
>>
>> thanks
>> Chris
>>
>>
>>
>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20a5ed5a-97f4-413b-8700-58606b781a2f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odLVAXZBkf8_VAdsRHU%2Biz11H73vzoRE-5dVB7QbHFA_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread Jani Tiainen
Hi again,

and as I said, Django templating language is not a programming language and
it doesn't support it (it's by design).

If your graphobject is a list of items, use iterating it over as Matthew
Pava suggested in his reply.

Otherwise you need to either create custom tag/filter that returns what you
want, or change dataformat suitable for displaying and processing in
template.

On Thu, Apr 19, 2018 at 7:35 PM,  wrote:

> As I said, the data is already stored in variable: graphobject, I can
> simply achieve my goal by coding like this: {{% graphobject.1%}}, {{%
> graphobject.2 %}} .. But I want a loop to do that
>
> 在 2018年4月19日星期四 UTC+2下午6:29:18,Jani Tiainen写道:
>>
>> Hi. Django templating language isn't programming language. It can't do
>> that. You need to prepare data suitable for displaying in your view.
>>
>>
>> On Thu, Apr 19, 2018 at 7:01 PM,  wrote:
>>
>>> I am currently working on django.
>>>
>>> I have a list of values which stored in 'graphobject', and 'metarange'
>>> is defined as range(0,59). In that case, how could I use numbers as
>>> argument to display the value stored in graphobject? I tried using
>>> following codes but it doesn't work
>>>
>>>
>>> {% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% 
>>> endif %}{% endfor %}
>>>
>>>
>>> Please tell me how could I do 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/75e8baed-3009-4f53-9f72-7260a2467dfc%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odQFoJeynE9bSXRTAw_9CqLC5BJUuyXQ8i3eRBoEPF5rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread shawnmhy
As I said, the data is already stored in variable: graphobject, I can 
simply achieve my goal by coding like this: {{% graphobject.1%}}, {{% 
graphobject.2 %}} .. But I want a loop to do that

在 2018年4月19日星期四 UTC+2下午6:29:18,Jani Tiainen写道:
>
> Hi. Django templating language isn't programming language. It can't do 
> that. You need to prepare data suitable for displaying in your view.
>
>
> On Thu, Apr 19, 2018 at 7:01 PM,  wrote:
>
>> I am currently working on django.
>>
>> I have a list of values which stored in 'graphobject', and 'metarange' is 
>> defined as range(0,59). In that case, how could I use numbers as argument 
>> to display the value stored in graphobject? I tried using following codes 
>> but it doesn't work
>>
>>
>> {% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% 
>> endif %}{% endfor %}
>>
>>
>> Please tell me how could I do 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75e8baed-3009-4f53-9f72-7260a2467dfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread Matthew Pava
Is there something stopping you from using this construct?
{% for item in graphobject %}

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Jani Tiainen
Sent: Thursday, April 19, 2018 11:29 AM
To: django-users@googlegroups.com
Subject: Re: Use self-increasing arguments in numeric for-loop in Django

Hi. Django templating language isn't programming language. It can't do that. 
You need to prepare data suitable for displaying in your view.


On Thu, Apr 19, 2018 at 7:01 PM, 
> wrote:

I am currently working on django.

I have a list of values which stored in 'graphobject', and 'metarange' is 
defined as range(0,59). In that case, how could I use numbers as argument to 
display the value stored in graphobject? I tried using following codes but it 
doesn't work



{% for i in metarange %}

{% if graphobject.i != '' %}

{{ graphobject.i }}

{% endif %}

{% endfor %}



Please tell me how could I do 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 post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...
--
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 post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odiq4Cu3fvcTowWW5n11oUSppkA-scNi8WRR4xOVYN38g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8aaed14e428848f68d5c11a203abecb4%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread Jani Tiainen
Hi. Django templating language isn't programming language. It can't do
that. You need to prepare data suitable for displaying in your view.


On Thu, Apr 19, 2018 at 7:01 PM,  wrote:

> I am currently working on django.
>
> I have a list of values which stored in 'graphobject', and 'metarange' is
> defined as range(0,59). In that case, how could I use numbers as argument
> to display the value stored in graphobject? I tried using following codes
> but it doesn't work
>
>
> {% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% 
> endif %}{% endfor %}
>
>
> Please tell me how could I do 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odiq4Cu3fvcTowWW5n11oUSppkA-scNi8WRR4xOVYN38g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread shawnmhy


I am currently working on django.

I have a list of values which stored in 'graphobject', and 'metarange' is 
defined as range(0,59). In that case, how could I use numbers as argument 
to display the value stored in graphobject? I tried using following codes 
but it doesn't work


{% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% endif 
%}{% endfor %}


Please tell me how could I do 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Login with email address, mobile number or username.

2018-04-19 Thread Andy
Firt of all you should start with you own user model because changing it 
afterwards is not that easy like stated in the docs.
>From there you can change the username restrictions to your liking and 
implement the cell_phone field.

Then implement you own version of ModelBackend which is also checking email 
and cell phone.
In case you just want to allow email, you can also switch to that with just 
changing a setting: 
https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#django.contrib.auth.models.CustomUser.USERNAME_FIELD


Am Donnerstag, 19. April 2018 13:18:02 UTC+2 schrieb lakshitha kumara:
>
> Hello Guys ,
>
> what is the best way to implement Login with email address, mobile number 
> or username. all those field save as a different field in user table. user 
> can login with any criteria that user provided to registered. its look like 
> how instagram.com does it. i need know what is the best way to implement 
> this. Username field cant include '@' sign and username should be letter, 
> number and '_' .
>
> 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd196388-a59e-4f02-a20e-c1bc8211a1d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Input and output is single page using forms.py

2018-04-19 Thread sathish ponaganti
Hi Jason,

Thanks for your response,  i'm pretty new to Django framework , could you
prove the sample code if you have.



On Thu, Apr 19, 2018 at 4:21 PM, Jason  wrote:

> If you're making a single page application, then you're probably using
> something like angular, vue or react for the browser side development.
> Check out Django Rest Framework for ease of building a RESTful API that you
> can use.
>
>
> On Wednesday, April 18, 2018 at 3:18:09 PM UTC-4, sathish ponaganti wrote:
>>
>> Hi All,
>>
>> I'm create a one applications using django frame work, my requirement is
>> input and our  should be on the same page (like input test box and output
>> text box)
>>
>>
>> please help me how to create a forms.py and views.py
>>
>> appreciate 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/bf2d343b-9a90-4f31-99a7-7e5837d26274%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH%3DM-vhQF3nSAU1e3e-mxwO3%3DLQTLK%2BvFmmfzFnojU17OFEf6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Adding stored procedures

2018-04-19 Thread Matthew Pava
Hi Chris,
The migrations will be run whenever you execute the migrate command.  When I 
want to make changes to an unmanaged model, in the next migration file I add a 
DROP statement to RunSQL, and then the new code to generate the VIEW.  I 
haven’t attempted reversing a migration, though.  I try to test with the new 
migration before deploying to production.
Best wishes,
Matthew

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Chris Wedgwood
Sent: Thursday, April 19, 2018 9:02 AM
To: Django users
Subject: Re: Adding stored procedures

Thanks Matthew

I probably need to think about this some more

I think using runsql will work. Do you know if you can set migrations to be 
rerunnable? It would be useful to be able to change something like a stored 
procedure and then it gets dropped and recreated each deployment

Saying that the stored procedure is going to be used for an import task that 
isn't actually related to Django so probably needs to be deployed  by another 
mechanism and I should leave migrations for only DJango specific changes

thanks
Chris



On Wednesday, 18 April 2018 07:50:52 UTC+1, Chris Wedgwood wrote:
Hi All

I am using SQL SERVER in my latest django project and I am going to be using 
some stored procedures.

My question is about how to go about deploying stored procedure changes with 
django. I have looked through the migrations documentation which looks very 
specific to model changes.

Has anyone had experience of having to create other things such a stored 
procedures/views/functions?

thanks
Chris




--
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 post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20a5ed5a-97f4-413b-8700-58606b781a2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/373c82f3da11492182afcb2ee961d0fd%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: perhap buys in autodetector.py

2018-04-19 Thread Tim Graham
When you say, "remove all previous migration codes" -- you mean you removed 
all the migration files such as 0001_initial.py? In that case, make sure 
you don't remove the __init__.py file, otherwise you must use 
"makemigrations app_name".

On Thursday, April 19, 2018 at 7:18:02 AM UTC-4, guzheng2000 wrote:
>
> Hi,
>
> Django prompts "no changes..." when I want to re-create migration codes by 
> calling makemigrations after remove all previous migration codes. After 
> some digs, I found it can be fixed by changing:
> [autodetector.py:151] "al not in self.from_state.real_apps " ==> "al not 
> in self.to_state.real_apps"
>
> Just let you guys know, I'm not sure it is correct.
> thanks,
> gz
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b0d0da83-2935-418f-85b8-433f0eac5cfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding stored procedures

2018-04-19 Thread Chris Wedgwood
Thanks Matthew

I probably need to think about this some more

I think using runsql will work. Do you know if you can set migrations to be 
rerunnable? It would be useful to be able to change something like a stored 
procedure and then it gets dropped and recreated each deployment

Saying that the stored procedure is going to be used for an import task 
that isn't actually related to Django so probably needs to be deployed  by 
another mechanism and I should leave migrations for only DJango specific 
changes

thanks
Chris
 


On Wednesday, 18 April 2018 07:50:52 UTC+1, Chris Wedgwood wrote:
>
> Hi All
>
> I am using SQL SERVER in my latest django project and I am going to be 
> using some stored procedures.
>
> My question is about how to go about deploying stored procedure changes 
> with django. I have looked through the migrations documentation which looks 
> very specific to model changes.
>
> Has anyone had experience of having to create other things such a stored 
> procedures/views/functions?
>
> thanks
> Chris
>
>
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20a5ed5a-97f4-413b-8700-58606b781a2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django generated migration fails with KeyError for field that was removed from the model.

2018-04-19 Thread Jani Tiainen
Hi,

Is that complete model definition?

Since exception seems to go through modifying composed index
(unique_together) where you might still have reference to deleted field.


On Thu, Apr 19, 2018 at 3:36 PM, James Farris 
wrote:

> My guess is that field is not empty in the database or it’s being called
> in a view or template still.
>
> Sent from my mobile device
>
> On Apr 18, 2018, at 2:59 PM, jackotonye  wrote:
>
> A migration generated with `python manage.py makemigrations` Fails to
> execute using `python manage.py migrate`.
>
>
> Model Layout:
>
> class Offer(BaseModel):
> client = models.ForeignKey(Client, on_delete=models.PROTECT, 
> related_name='offers')
> amount_off = models.DecimalField(max_digits=5, decimal_places=2, 
> default=Decimal('0.00')).  # Removed this field from the model
>
>
>
> Generated Migration file:
>
> # Generated by Django 2.0.2 on 2018-04-18 21:36
>
> from django.db import migrations
>
>
> class Migration(migrations.Migration):
>
> dependencies = [
> ('my_app', '0031_auto_20180418_1802'),
> ]
>
> operations = [
> migrations.RemoveField(
> model_name='offer',
> name='amount_off',
> ),
> ]
>
>
>
>
>
> Error:
> Running migrations:
>
>   Applying my_app.0032_auto_20180418_2136...Traceback (most recent call
> last):
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/models/options.py", line 566, in get_field
>
> return self.fields_map[field_name]
>
> KeyError: 'amount_off'
>
>
> During handling of the above exception, another exception occurred:
>
>
> Traceback (most recent call last):
>
>   File "manage.py", line 22, in 
>
> execute_from_command_line(sys.argv)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 371, in
> execute_from_command_line
>
> utility.execute()
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 365, in execute
>
> self.fetch_command(subcommand).run_from_argv(self.argv)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/core/management/base.py", line 288, in run_from_argv
>
> self.execute(*args, **cmd_options)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/core/management/base.py", line 335, in execute
>
> output = self.handle(*args, **options)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/core/management/commands/migrate.py", line 200, in handle
>
> fake_initial=fake_initial,
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/migrations/executor.py", line 117, in migrate
>
> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
> fake_initial=fake_initial)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/migrations/executor.py", line 147, in
> _migrate_all_forwards
>
> state = self.apply_migration(state, migration, fake=fake, fake_initial
> =fake_initial)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/migrations/executor.py", line 244, in apply_migration
>
> state = migration.apply(state, schema_editor)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/migrations/migration.py", line 122, in apply
>
> operation.database_forwards(self.app_label, schema_editor, old_state,
> project_state)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/migrations/operations/models.py", line 525, in
> database_forwards
>
> getattr(new_model._meta, self.option_name, set()),
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/backends/base/schema.py", line 342, in
> alter_unique_together
>
> self._delete_composed_index(model, fields, {'unique': True}, self.
> sql_delete_unique)
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/backends/base/schema.py", line 365, in
> _delete_composed_index
>
> columns = [model._meta.get_field(field).column for field in fields]
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/backends/base/schema.py", line 365, in 
>
> columns = [model._meta.get_field(field).column for field in fields]
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/models/options.py", line 568, in get_field
>
> raise FieldDoesNotExist("%s has no field named '%s'" % (self.
> object_name, field_name))
>
> django.core.exceptions.FieldDoesNotExist: Offer has no field named
> 'amount_off'
>
>
>
>
>
>
>
> --
> 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

Re: Django generated migration fails with KeyError for field that was removed from the model.

2018-04-19 Thread James Farris
My guess is that field is not empty in the database or it’s being called in a 
view or template still. 

Sent from my mobile device

> On Apr 18, 2018, at 2:59 PM, jackotonye  wrote:
> 
> A migration generated with `python manage.py makemigrations` Fails to execute 
> using `python manage.py migrate`.
> 
> 
> Model Layout:
> 
> class Offer(BaseModel):
> client = models.ForeignKey(Client, on_delete=models.PROTECT, 
> related_name='offers')
> amount_off = models.DecimalField(max_digits=5, decimal_places=2, 
> default=Decimal('0.00')).  # Removed this field from the model
> 
> 
> 
> Generated Migration file:
> 
> # Generated by Django 2.0.2 on 2018-04-18 21:36
> 
> from django.db import migrations
> 
> 
> class Migration(migrations.Migration):
> 
> dependencies = [
> ('my_app', '0031_auto_20180418_1802'),
> ]
> 
> operations = [
> migrations.RemoveField(
> model_name='offer',
> name='amount_off',
> ),
> ]
> 
> 
> 
> 
> Error:
> Running migrations:
> 
>   Applying my_app.0032_auto_20180418_2136...Traceback (most recent call last):
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/models/options.py",
>  line 566, in get_field
> 
> return self.fields_map[field_name]
> 
> KeyError: 'amount_off'
> 
> 
> During handling of the above exception, another exception occurred:
> 
> 
> Traceback (most recent call last):
> 
>   File "manage.py", line 22, in 
> 
> execute_from_command_line(sys.argv)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/__init__.py",
>  line 371, in execute_from_command_line
> 
> utility.execute()
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/__init__.py",
>  line 365, in execute
> 
> self.fetch_command(subcommand).run_from_argv(self.argv)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/base.py",
>  line 288, in run_from_argv
> 
> self.execute(*args, **cmd_options)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/base.py",
>  line 335, in execute
> 
> output = self.handle(*args, **options)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/commands/migrate.py",
>  line 200, in handle
> 
> fake_initial=fake_initial,
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/executor.py",
>  line 117, in migrate
> 
> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, 
> fake_initial=fake_initial)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/executor.py",
>  line 147, in _migrate_all_forwards
> 
> state = self.apply_migration(state, migration, fake=fake, 
> fake_initial=fake_initial)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/executor.py",
>  line 244, in apply_migration
> 
> state = migration.apply(state, schema_editor)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/migration.py",
>  line 122, in apply
> 
> operation.database_forwards(self.app_label, schema_editor, old_state, 
> project_state)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/operations/models.py",
>  line 525, in database_forwards
> 
> getattr(new_model._meta, self.option_name, set()),
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/backends/base/schema.py",
>  line 342, in alter_unique_together
> 
> self._delete_composed_index(model, fields, {'unique': True}, 
> self.sql_delete_unique)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/backends/base/schema.py",
>  line 365, in _delete_composed_index
> 
> columns = [model._meta.get_field(field).column for field in fields]
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/backends/base/schema.py",
>  line 365, in 
> 
> columns = [model._meta.get_field(field).column for field in fields]
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/models/options.py",
>  line 568, in get_field
> 
> raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, 
> field_name))
> 
> django.core.exceptions.FieldDoesNotExist: Offer has no field named 
> 'amount_off'
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at 

Login with email address, mobile number or username.

2018-04-19 Thread lakshitha kumara
Hello Guys ,

what is the best way to implement Login with email address, mobile number 
or username. all those field save as a different field in user table. user 
can login with any criteria that user provided to registered. its look like 
how instagram.com does it. i need know what is the best way to implement 
this. Username field cant include '@' sign and username should be letter, 
number and '_' .

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd1ce71e-89e8-4ebf-960f-9a72a231eb6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


perhap buys in autodetector.py

2018-04-19 Thread guzheng2000
Hi,

Django prompts "no changes..." when I want to re-create migration codes by 
calling makemigrations after remove all previous migration codes. After 
some digs, I found it can be fixed by changing:
[autodetector.py:151] "al not in self.from_state.real_apps " ==> "al not in 
self.to_state.real_apps"

Just let you guys know, I'm not sure it is correct.
thanks,
gz

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba03af50-99ba-4eb2-9d4e-7831c019474e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Input and output is single page using forms.py

2018-04-19 Thread Jason
If you're making a single page application, then you're probably using 
something like angular, vue or react for the browser side development.  
Check out Django Rest Framework for ease of building a RESTful API that you 
can use.

On Wednesday, April 18, 2018 at 3:18:09 PM UTC-4, sathish ponaganti wrote:
>
> Hi All,
>
> I'm create a one applications using django frame work, my requirement is 
> input and our  should be on the same page (like input test box and output 
> text box)
>
>
> please help me how to create a forms.py and views.py
>
> appreciate 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf2d343b-9a90-4f31-99a7-7e5837d26274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cors and images via dj-static

2018-04-19 Thread Andy
Hi, is there a way to serve media files via dj-static with the addition of 
CORS headers?


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2df21cca-e03e-4e83-a0e6-55961af71213%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.