Error at OneToOneField in models while creating new models class

2018-09-22 Thread Srinivas Gadi
HI All,

I am facing below error while creating a new model class.
the error pop up only at this line "user = models.OneToOneField(User)"
*"E1120:No value for argument 'on_delete' in constructor call"*

from django.db import models
from django.contrib.auth.models import User

class userProfile(models.Model):
user = models.OneToOneField(User)

If I add "user = models.OneToOneField(User,*on_delete=models.CASCADE*)" the
error got subsided but the new class "userProfile" is not appearing in
admin page, under Users tab.

Could some one please guide me how to fix this ?

-- 
Srinivas .G
  9966559383

-- 
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/CAPC7spjtRVaCYjhDqn03_cc%2B-qgEWRAHSX5ScG37ePRApFz32Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error at OneToOneField in models while creating new models class

2018-09-22 Thread Srinivas Gadi
Adding more and complete details:
I am facing below error while creating a new model class.
the error pops up only at this line "user = models.OneToOneField(User)"
*"E1120:No value for argument 'on_delete' in constructor call"*

section/models.py

from django.db import modelsfrom django.contrib.auth.models import User
class userProfile(models.Model):
user = models.OneToOneField(User)

admin.py

from django.contrib import adminfrom section.models import userProfile

admin.site.register(userProfile)

If I add below entry with "on_delete=models.CASCADE"

user = models.OneToOneField(User,on_delete=models.CASCADE)

the error got subsided but the new class "userProfile" is not appearing in
admin page, under Users tab.

Also, run migrations:

C:\Users\srini\djangoProjects\college>python manage.py
makemigrationsNo changes detected

C:\Users\srini\djangoProjects\college>python manage.py
migrateOperations to perform:Apply all migrations: admin, auth,
contenttypes, sessionsRunning migrations:No migrations to apply.

Could someone please guide me how to fix this?

On Sat, Sep 22, 2018 at 2:40 PM Srinivas Gadi  wrote:

> HI All,
>
> I am facing below error while creating a new model class.
> the error pop up only at this line "user = models.OneToOneField(User)"
> *"E1120:No value for argument 'on_delete' in constructor call"*
>
> from django.db import models
> from django.contrib.auth.models import User
>
> class userProfile(models.Model):
> user = models.OneToOneField(User)
>
> If I add "user = models.OneToOneField(User,*on_delete=models.CASCADE*)"
> the error got subsided but the new class "userProfile" is not appearing
> in admin page, under Users tab.
>
> Could some one please guide me how to fix this ?
>
> --
> Srinivas .G
>   9966559383
>


-- 
Srinivas .G
  9966559383

-- 
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/CAPC7spgQAR0e28KtZG4Ljt%3Dk4Su39qipvZJaRy4%3DCJbD6CTMCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error at OneToOneField in models while creating new models class

2018-09-22 Thread Matthew Pava
Did you try running your migrations?

Get Outlook for Android




On Sat, Sep 22, 2018 at 5:07 AM -0500, "Srinivas Gadi" 
mailto:srini@gmail.com>> wrote:

Adding more and complete details:
I am facing below error while creating a new model class.
the error pops up only at this line "user = models.OneToOneField(User)"
"E1120:No value for argument 'on_delete' in constructor call"


section/models.py

from django.db import models
from django.contrib.auth.models import User

class userProfile(models.Model):
user = models.OneToOneField(User)

admin.py

from django.contrib import admin
from section.models import userProfile

admin.site.register(userProfile)

If I add below entry with "on_delete=models.CASCADE"

user = models.OneToOneField(User,on_delete=models.CASCADE)

the error got subsided but the new class "userProfile" is not appearing in 
admin page, under Users tab.

Also, run migrations:

C:\Users\srini\djangoProjects\college>python manage.py makemigrations
No changes detected

C:\Users\srini\djangoProjects\college>python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.

Could someone please guide me how to fix this?

On Sat, Sep 22, 2018 at 2:40 PM Srinivas Gadi 
mailto:srini@gmail.com>> wrote:
HI All,

I am facing below error while creating a new model class.
the error pop up only at this line "user = models.OneToOneField(User)"
"E1120:No value for argument 'on_delete' in constructor call"

from django.db import models
from django.contrib.auth.models import User

class userProfile(models.Model):
user = models.OneToOneField(User)

If I add "user = models.OneToOneField(User,on_delete=models.CASCADE)" the error 
got subsided but the new class "userProfile" is not appearing in admin page, 
under Users tab.

Could some one please guide me how to fix this ?

--
Srinivas .G
  9966559383


--
Srinivas .G
  9966559383

--
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/CAPC7spgQAR0e28KtZG4Ljt%3Dk4Su39qipvZJaRy4%3DCJbD6CTMCA%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/D9BEB906A6B607A4.5302fd9d-847e-4878-88de-82caf2f9c69b%40mail.outlook.com.
For more options, visit https://groups.google.com/d/optout.


Create tables for models in your database

2018-09-22 Thread talkdkg
Hi

getting an error while run this code...

python manage.py makemigrations blog
Traceback (most recent call last):
  File "manage.py", line 22, in 
execute_from_command_line(sys.argv)
  File 
"/home/dheerajkumar/.local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 364, in execute_from_command_line
utility.execute()
  File 
"/home/dheerajkumar/.local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 338, in execute
django.setup()
  File 
"/home/dheerajkumar/.local/lib/python2.7/site-packages/django/__init__.py", 
line 27, in setup
apps.populate(settings.INSTALLED_APPS)
  File 
"/home/dheerajkumar/.local/lib/python2.7/site-packages/django/apps/registry.py",
 
line 108, in populate
app_config.import_models()
  File 
"/home/dheerajkumar/.local/lib/python2.7/site-packages/django/apps/config.py", 
line 202, in import_models
self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
  File "/home/dheerajkumar/djangogirls/myvenv/myproject/blog/models.py", 
line 6
author = models.Foreignkey('auth.User', on_delete=models.CASCADE)
 ^
IndentationError: expected an indented block

please help, I'm new in Django

-- 
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/1c817fdf-8ee2-43e8-9a2f-cb150f1643ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create tables for models in your database

2018-09-22 Thread Kasper Laudrup

Hi,

On 22/09/2018 14.21, talk...@gmail.com wrote:


getting an error while run this code...

  "/home/dheerajkumar/djangogirls/myvenv/myproject/blog/models.py",
  line 6
       author = models.Foreignkey('auth.User', on_delete=models.CASCADE)
    ^
  IndentationError: expected an indented block



As the error message clearly states, you have an error on line 6 in your 
models.py file where a line doesn't match the expected indentation.


Python uses indentation for scoping. This is very fundamental in python.

I would suggest you use an editor that understands python. Then you 
would most like have the error highlighted on that exact line and the 
editor would help you by suggesting different indentations, so you'd be 
able to fix the error before even running the code.


Which editor to choose is mostly a matter of taste, but I do highly 
recommend something that understands python. That will help you a lot 
and save you a lot of time.


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/27f41b64-da4b-e1ef-7ef8-31fe6db0df3b%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Create tables for models in your database

2018-09-22 Thread Dheeraj Kumar
Thanks. I'm going to install pycharm now.

On Sat, 22 Sep 2018 at 18:03, Kasper Laudrup  wrote:

> Hi,
>
> On 22/09/2018 14.21, talk...@gmail.com wrote:
> >
> > getting an error while run this code...
> >
> >   "/home/dheerajkumar/djangogirls/myvenv/myproject/blog/models.py",
> >   line 6
> >author = models.Foreignkey('auth.User',
> on_delete=models.CASCADE)
> > ^
> >   IndentationError: expected an indented block
> >
>
> As the error message clearly states, you have an error on line 6 in your
> models.py file where a line doesn't match the expected indentation.
>
> Python uses indentation for scoping. This is very fundamental in python.
>
> I would suggest you use an editor that understands python. Then you
> would most like have the error highlighted on that exact line and the
> editor would help you by suggesting different indentations, so you'd be
> able to fix the error before even running the code.
>
> Which editor to choose is mostly a matter of taste, but I do highly
> recommend something that understands python. That will help you a lot
> and save you a lot of time.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/27f41b64-da4b-e1ef-7ef8-31fe6db0df3b%40stacktrace.dk
> .
> 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/CANwUEV9S8-tmzGGLH-YVRBxfjTGFZdXOb%2BLWVjyMQ_tjb55%2BcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Project Update on Server

2018-09-22 Thread Parag Sharma
Hello, I am working on a django project. Recently I have added TinyMCE Html 
Text editor in my project. It working perfectly on my local server. Then I 
update code to live server using from DigitalOcean, install require 
libraries then firsly restart the Guicron but the changes is not visible on 
my live site then I also restart the nginx but still not getting any update 
in live project. Please help m. 

-- 
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/9830dd64-f5df-4cdc-80f4-05056179cd99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Project Update on Server

2018-09-22 Thread gilwell muhati
Hello Parag,

Have a look at this
https://docs.djangoproject.com/en/2.1/ref/contrib/staticfiles/

Did you run collectstaticfiles?

If you made any changes to the models file,please makemigrations and
migrate them.




*Regards,Gilwell Muhati | +254 710 739 116 | *
*~~“The mind is its own place and in itself can make a heaven of hell, a
hell of heaven…”~~John Milton *


On Sat, Sep 22, 2018 at 7:24 PM Parag Sharma 
wrote:

> Hello, I am working on a django project. Recently I have added TinyMCE
> Html Text editor in my project. It working perfectly on my local server.
> Then I update code to live server using from DigitalOcean, install require
> libraries then firsly restart the Guicron but the changes is not visible on
> my live site then I also restart the nginx but still not getting any update
> in live project. Please help m.
>
> --
> 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/9830dd64-f5df-4cdc-80f4-05056179cd99%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/CALO4FhG3vOAT0--B1je_E6TJ%3DtrEZN7VDb4_BzEJOUfCtaTqPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error at OneToOneField in models while creating new models class

2018-09-22 Thread Srinivas Gadi
Yes, provided the migrations out put in the second mail

On Sat, 22 Sep 2018, 17:11 Matthew Pava,  wrote:

> Did you try running your migrations?
>
> Get Outlook for Android 
>
>
>
>
> On Sat, Sep 22, 2018 at 5:07 AM -0500, "Srinivas Gadi" <
> srini@gmail.com> wrote:
>
> Adding more and complete details:
>> I am facing below error while creating a new model class.
>> the error pops up only at this line "user = models.OneToOneField(User)"
>> *"E1120:No value for argument 'on_delete' in constructor call"*
>>
>> section/models.py
>>
>> from django.db import modelsfrom django.contrib.auth.models import User
>> class userProfile(models.Model):
>> user = models.OneToOneField(User)
>>
>> admin.py
>>
>> from django.contrib import adminfrom section.models import userProfile
>>
>> admin.site.register(userProfile)
>>
>> If I add below entry with "on_delete=models.CASCADE"
>>
>> user = models.OneToOneField(User,on_delete=models.CASCADE)
>>
>> the error got subsided but the new class "userProfile" is not appearing
>> in admin page, under Users tab.
>>
>> Also, run migrations:
>>
>> C:\Users\srini\djangoProjects\college>python manage.py makemigrationsNo 
>> changes detected
>>
>> C:\Users\srini\djangoProjects\college>python manage.py migrateOperations to 
>> perform:Apply all migrations: admin, auth, contenttypes, sessionsRunning 
>> migrations:No migrations to apply.
>>
>> Could someone please guide me how to fix this?
>>
>> On Sat, Sep 22, 2018 at 2:40 PM Srinivas Gadi 
>> wrote:
>>
>>> HI All,
>>>
>>> I am facing below error while creating a new model class.
>>> the error pop up only at this line "user = models.OneToOneField(User)"
>>> *"E1120:No value for argument 'on_delete' in constructor call"*
>>>
>>> from django.db import models
>>> from django.contrib.auth.models import User
>>>
>>> class userProfile(models.Model):
>>> user = models.OneToOneField(User)
>>>
>>> If I add "user = models.OneToOneField(User,*on_delete=models.CASCADE*)"
>>> the error got subsided but the new class "userProfile" is not appearing
>>> in admin page, under Users tab.
>>>
>>> Could some one please guide me how to fix this ?
>>>
>>> --
>>> Srinivas .G
>>>   9966559383
>>>
>>
>>
>> --
>> Srinivas .G
>>   9966559383
>>
>> --
>> 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/CAPC7spgQAR0e28KtZG4Ljt%3Dk4Su39qipvZJaRy4%3DCJbD6CTMCA%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/D9BEB906A6B607A4.5302fd9d-847e-4878-88de-82caf2f9c69b%40mail.outlook.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/CAPC7spiyJ5_kCtVfwpui2TALrQw-fpM7O40QucTryeX5qst7Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.