django send_mail

2019-03-27 Thread Aayush Bhattarai


[image: isjs.PNG]
How to send this form in django send_mail. 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 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/2701bc34-cd91-4e24-8be9-b17bfab31f5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django send_mail

2019-03-27 Thread Anirudh Jain
Instead of creating a word file, create a HTML template for it if you want
the links of your social media accounts to work. Otherwise jusy save this
file in static/images folder and load it in a template. Either way you will
have to create a template.

On Wed, 27 Mar 2019, 13:08 Aayush Bhattarai, 
wrote:

> [image: isjs.PNG]
> How to send this form in django send_mail. 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 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/2701bc34-cd91-4e24-8be9-b17bfab31f5f%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/CAC3mK7fvJQ3vCs%3DpBHN6Qe4m7CD6%2B_TM%2BU9kw1qk7QWFa0tH8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Inconsistent Django test results depending upon how the test is called in Django 1.5.1 running on Python 2.7.4

2019-03-27 Thread Ruben Alves
I had a similar problem and I solved it by making all tests inherit from 
`django.test.TestCase`.  I had some tests inheriting from 
`unittest.TestCase`, which doesn't reset the database after the test is 
finished.

I found the answer on https://stackoverflow.com/a/436795/6490637

Em segunda-feira, 2 de dezembro de 2013 00:24:01 UTC, Paul Whipp escreveu:
>
> I have test cases that pass when tested individually, pass when the full 
> app is tested but fail when the tests for the entire project are run:
>
> (lsapi)~ $ django test
> Creating test database for alias 'default'...
> .s.x..Exception
>  RuntimeError: 'maximum recursion depth exceeded' in  0x13447d0> ignored
> Exception RuntimeError: 'maximum recursion depth exceeded' in  remove at 0x13447d0> ignored
> Exception RuntimeError: 'maximum recursion depth exceeded' in  remove at 0x13447d0> ignored
> ...ssE.E.E.Setting
>  content_object to liquid app one
> .EEE....
> ==
> ERROR: test_get_direct_notes (lsapi.tests.DirectGetTestCase)
> --
> Traceback (most recent call last):
>   File "ls-api/lsapi/tests.py", line 869, in _method
> 
>   File "ls-core/lscore/model/note.py", line 37, in company
> return self.content_object.company
> AttributeError: 'NoneType' object has no attribute 'company'
> ...
>
>
> (lsapi)~ $ django test lsapi.NotesTestCase.test_wrong_user_cannot_put
> Creating test database for alias 'default'...
> .
> --
> Ran 1 test in 0.241s
>
> OK
> Destroying test database for alias 'default'...
>
>
> (lsapi)~ $ django test lsapi
> Creating test database for alias 'default'...
> ...ss..Setting
>  content_object to liquid app one
> ...Exception RuntimeError: 'maximum recursion depth exceeded 
> while calling a Python object' in <_ctypes.DictRemover object at 0x46dac70> 
> ignored
> .
> --
> Ran 303 tests in 71.469s
>
> OK (skipped=2)
> Destroying test database for alias 'default'...
>
> The 'django' command is an alias for django-admin.py. So the tests pass if 
> run as a single case or as a test suite when testing the entire app but 
> fail with errors if run when running the tests for all of the apps in the 
> project.
>
> Investigating the error in the full suite test: It is the result of an 
> attribute being None when it 'should' have a value. The attribute is a 
> content_object set up in a fixture.
>
> I added a debugging setattr on the class and nothing is setting it to 
> None so it seems that the fixture code is not being properly executed to 
> set up the object leading to the errors. The fixture is using content types 
> because it is for 'notes' that can be associated with various model classes:
>
> notes.py:
>
> ...
> class Note(TimeStampedModel):
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
> content_object = generic.GenericForeignKey('content_type', 'object_id')
> ...
> def __setattr__(self, key, value):
>   if key == 'content_object':
>   if value is None:
>   import pdb; pdb.set_trace()
>   print('Setting content_object to {0}'.format(value))
>   return super(Note, self).__setattr__(key, value)
>
> local_test.json:
>
> ...
>  {"pk": 1, "model": "lscore.note",
>   "fields": {"content_type": 16,
>"object_id": 2,
>"created_by": 4,
>"text": "This is the note text"}},
> ...
>
> Thinking on this further, GenericForeignKey is likely to work by accessing 
> the content_type/object_id fields and the fixtures code will be responsible 
> for putting these directly into the database. On this basis, I trapped the 
> error and investigated the database at the point when it occurred in the 
> full suite te

1054, "Unknown column 'userprofile_user.phone' in 'field list'"

2019-03-27 Thread Pinkesh Narad
hello all,
I am new to this, and i am getting this error and unable to run my admin 
as of I did makemigration app-name also delete my migrations several time 
but still getting same error and i am stuck here. 
please help me 

-- 
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/4c5c5b76-d677-4323-97de-76246aacb9f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1054, "Unknown column 'userprofile_user.phone' in 'field list'"

2019-03-27 Thread Phako Perez
Review your model, seems you missed add phone into your model or some 
misspelling 

Sent from my iPhone

> On Mar 27, 2019, at 12:05 AM, Pinkesh Narad  
> wrote:
> 
> hello all,
> I am new to this, and i am getting this error and unable to run my admin 
> as of I did makemigration app-name also delete my migrations several time but 
> still getting same error and i am stuck here. 
> please help me 
> -- 
> 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/4c5c5b76-d677-4323-97de-76246aacb9f9%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/8E7E1BB1-4053-4C0F-AD2E-C5EDD277C000%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1054, "Unknown column 'userprofile_user.phone' in 'field list'"

2019-03-27 Thread Aayush Bhattarai
*First make migrations*
*python manage.py makemigrations YourAppName*

*and then migrate *
*python manage.py migrate*

*and create superuser*

*Maybe your error may be fixed.*

-- 
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/d380ea18-2667-47f9-95a5-1c372ae7f5a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-translated-fields

2019-03-27 Thread אורי
Hi,

Please take a look at this issue:
https://github.com/matthiask/django-translated-fields/issues/10

Do you have any solution?

In short, I'm trying to convert Speedy Net from
using django-modeltranslation to django-translated-fields. I defined the
models and forms and everything works in English, but in another language
(Hebrew) I have a problem that the form fields are defined in English
instead of Hebrew (the current language). What did I do wrong and how do I
define the form to work in the current language? (the fields defined
by TranslatedField in the model should be visible only with the current
language in the form SpeedyMatchProfileActivationForm).

You can see the code here:
https://github.com/speedy-net/speedy-net/tree/uri_try_django_translated_fields_2019-03-26_a
https://github.com/speedy-net/speedy-net/blob/uri_try_django_translated_fields_2019-03-26_a/speedy/match/accounts/forms.py
https://github.com/speedy-net/speedy-net/blob/uri_try_django_translated_fields_2019-03-26_a/speedy/match/accounts/models.py

By the way, one of the reasons I want to switch to django-translated-fields
is because it defines only 2 (the number of languages) fields in the
database, and django-modeltranslation defines 3 fields - one of them (the
main field without any language) seems to me not necessary at all. Take a
look at:
https://github.com/deschler/django-modeltranslation/issues/488

Thanks!


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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/CABD5YeG%2BdXhnoSwi4gJ289GxbiLA_91W-w2RWdpzCJNzUYehMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread goodresults
--

-- 
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/337bb1f9-3880-41b9-8e60-5786ec14743c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread Phako Perez
Isn’t required, it depends on you as PyCharm has more functionalities 

Sent from my iPhone

> On Mar 27, 2019, at 12:49 PM, goodresults  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 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/337bb1f9-3880-41b9-8e60-5786ec14743c%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/6B05757A-741F-4C00-B4A2-35912CE5E361%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread Pedro Folch
It really helps try it

On Wed, Mar 27, 2019, 1:11 PM Phako Perez <13.phak...@gmail.com> wrote:

> Isn’t required, it depends on you as PyCharm has more functionalities
>
> Sent from my iPhone
>
> On Mar 27, 2019, at 12:49 PM, goodresults  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 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/337bb1f9-3880-41b9-8e60-5786ec14743c%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/6B05757A-741F-4C00-B4A2-35912CE5E361%40gmail.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/CAGG-qpfdvhy0LbTL3sv8KEzMf%2BgmHEUzxB6ENP%3DJopcxF_oxPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread Bill Freeman
Like many tools, it will take longer to learn to use it well than it takes
to code a small project, though it will start to help along the way.  As an
emacs user, I already had what I needed and more, so it was hard to justify
the extra effort, but I was working where everyone else used it, and it
helped for everyone to be able to type effectively at one another's
keyboards.  It is popular enough that even if you aren't in such a
situation now, you man find yourself in one in the future.

On Wed, Mar 27, 2019 at 3:39 PM Pedro Folch  wrote:

> It really helps try it
>
> On Wed, Mar 27, 2019, 1:11 PM Phako Perez <13.phak...@gmail.com> wrote:
>
>> Isn’t required, it depends on you as PyCharm has more functionalities
>>
>> Sent from my iPhone
>>
>> On Mar 27, 2019, at 12:49 PM, goodresults 
>> 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 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/337bb1f9-3880-41b9-8e60-5786ec14743c%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/6B05757A-741F-4C00-B4A2-35912CE5E361%40gmail.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/CAGG-qpfdvhy0LbTL3sv8KEzMf%2BgmHEUzxB6ENP%3DJopcxF_oxPw%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/CAB%2BAj0uoZP0RCwLvZxO5u%3DNeObq8%3DbejGwpdPD8YVgNV2buvng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create models using raw SQL queries

2019-03-27 Thread PASCUAL Eric
Hi,

Not sure Django is the right choice in your case since one of its main purposes 
is to hide the SQL stuff by putting the ORM in front.

You'd better use Flask, Tornado or any other Web framework which does not come 
with any special feature WRT data access.

Best

Eric


From: django-users@googlegroups.com  on behalf 
of cameron hochbrg 
Sent: Tuesday, March 26, 2019 21:36
To: Django users
Subject: Create models using raw SQL queries

hello,

for a project for a database class, we wanted to create a web app using django. 
However, our teacher wants us to use raw SQL queries for everything involving 
the database. As such I was wondering if it was possible to create mdoels using 
raw SQL queries.

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 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/8145efe7-c169-43d6-86e6-e0d64415a764%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/AM0P193MB03085C88060C9FA76F9FA8338C580%40AM0P193MB0308.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.


Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread mohamed khaled
You can use such as VS code atom and sublime text you can customize your
environment according programme language. Of course pycharm is great IDE
and uses for huge companies and mustn't use it

On Wed, Mar 27, 2019, 10:48 PM Bill Freeman  wrote:

> Like many tools, it will take longer to learn to use it well than it takes
> to code a small project, though it will start to help along the way.  As an
> emacs user, I already had what I needed and more, so it was hard to justify
> the extra effort, but I was working where everyone else used it, and it
> helped for everyone to be able to type effectively at one another's
> keyboards.  It is popular enough that even if you aren't in such a
> situation now, you man find yourself in one in the future.
>
> On Wed, Mar 27, 2019 at 3:39 PM Pedro Folch  wrote:
>
>> It really helps try it
>>
>> On Wed, Mar 27, 2019, 1:11 PM Phako Perez <13.phak...@gmail.com> wrote:
>>
>>> Isn’t required, it depends on you as PyCharm has more functionalities
>>>
>>> Sent from my iPhone
>>>
>>> On Mar 27, 2019, at 12:49 PM, goodresults 
>>> 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 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/337bb1f9-3880-41b9-8e60-5786ec14743c%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/6B05757A-741F-4C00-B4A2-35912CE5E361%40gmail.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/CAGG-qpfdvhy0LbTL3sv8KEzMf%2BgmHEUzxB6ENP%3DJopcxF_oxPw%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/CAB%2BAj0uoZP0RCwLvZxO5u%3DNeObq8%3DbejGwpdPD8YVgNV2buvng%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/CALvPq4K0RecgM-LJ43rqfEKksk3TU2xgS_5YvMG8432rc4Nk_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Updated package django-adminrestrict 2.0

2019-03-27 Thread robromano


django-adminrestrict enables you to block access to the Django admin pages 
unless requests come from specific IP addresses.  All management of access 
is done via admin pages themselves.  Simple wildcarding of IP addresses is 
supported.


It supports Django 1.4 or later, with recent support for Django 2.0/2.1 
added. The application is intended improve the security around the Django 
admin login pages.  Welcome any feedback, hope this is useful.



https://pypi.org/project/django-adminrestrict/





-- 
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/7c846de0-e34f-4e17-ab2b-d7ea4f146616%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create models using raw SQL queries

2019-03-27 Thread Simon A
hi Cameron, as Eric said, by doing this you might not fully take advantage 
of the features of django. But if you still want to proceed maybe you can 
use the managed option for 
models. https://docs.djangoproject.com/en/2.1/ref/models/options/#managed.

with this approach, you'll create the database tables manually first 
OUTSIDE of django, then connect django to it afterwards. I haven't tried it 
before but this might be what you need.

also if your teacher requires to perform raw sql queries rather than use 
the ORM, there is an option to use raw sql 
queries. 
https://docs.djangoproject.com/en/2.1/topics/db/sql/#executing-custom-sql-directly

On Thursday, March 28, 2019 at 6:16:54 AM UTC+8, Eric Pascual wrote:
>
> Hi,
>
> Not sure Django is the right choice in your case since one of its main 
> purposes is to hide the SQL stuff by putting the ORM in front. 
>
> You'd better use Flask, Tornado or any other Web framework which does not 
> come with any special feature WRT data access.
>
> Best
>
> Eric
>
> --
> *From:* django...@googlegroups.com  <
> django...@googlegroups.com > on behalf of cameron hochbrg <
> caos...@gmail.com >
> *Sent:* Tuesday, March 26, 2019 21:36
> *To:* Django users
> *Subject:* Create models using raw SQL queries 
>  
> hello,
>
> for a project for a database class, we wanted to create a web app using 
> django. However, our teacher wants us to use raw SQL queries for everything 
> involving the database. As such I was wondering if it was possible to 
> create mdoels using raw SQL queries.
>
> 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...@googlegroups.com .
> To post to this group, send email to djang...@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/8145efe7-c169-43d6-86e6-e0d64415a764%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/3a449e4d-12fe-48bb-bdf3-45a6d6a5203e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create models using raw SQL queries

2019-03-27 Thread cameron hochbrg
Thank you for your response. I am aware that django has for purpose to hide
the SQL. the reason why I wanted to use django is that I had used it before
and I didn't want to have to learn a new framework if possible.

Le mer. 27 mars 2019 à 21:33, Simon A  a écrit :

> hi Cameron, as Eric said, by doing this you might not fully take advantage
> of the features of django. But if you still want to proceed maybe you can
> use the managed option for models.
> https://docs.djangoproject.com/en/2.1/ref/models/options/#managed.
>
> with this approach, you'll create the database tables manually first
> OUTSIDE of django, then connect django to it afterwards. I haven't tried it
> before but this might be what you need.
>
> also if your teacher requires to perform raw sql queries rather than use
> the ORM, there is an option to use raw sql queries.
> https://docs.djangoproject.com/en/2.1/topics/db/sql/#executing-custom-sql-directly
>
> On Thursday, March 28, 2019 at 6:16:54 AM UTC+8, Eric Pascual wrote:
>>
>> Hi,
>>
>> Not sure Django is the right choice in your case since one of its main
>> purposes is to hide the SQL stuff by putting the ORM in front.
>>
>> You'd better use Flask, Tornado or any other Web framework which does not
>> come with any special feature WRT data access.
>>
>> Best
>>
>> Eric
>>
>> --
>> *From:* django...@googlegroups.com  on
>> behalf of cameron hochbrg 
>> *Sent:* Tuesday, March 26, 2019 21:36
>> *To:* Django users
>> *Subject:* Create models using raw SQL queries
>>
>> hello,
>>
>> for a project for a database class, we wanted to create a web app using
>> django. However, our teacher wants us to use raw SQL queries for everything
>> involving the database. As such I was wondering if it was possible to
>> create mdoels using raw SQL queries.
>>
>> 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...@googlegroups.com.
>> To post to this group, send email to djang...@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/8145efe7-c169-43d6-86e6-e0d64415a764%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/3a449e4d-12fe-48bb-bdf3-45a6d6a5203e%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/CAAZe9Jjg9BRo_h-5rZYMXMHAN5Ty%3DFCaaTiH8MTMrGBdT%2Bcd9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.