You can only pass in a keyword argument once, you pass in related_name twice in 
one of your properties

Sent from my iPhone

> On Nov 8, 2018, at 12:02 PM, Vishvajit Pathak <wishmore...@gmail.com> wrote:
> 
> in the code 
> 
>> parent = ForeignKey(
>>         'customers.Zone',
>>         on_delete=models.CASCADE, related_name="'zone's", null=True, 
>> related_name='children'
>>     )
> 
> key `related_name` is repeated
> 
> 
>> On Wednesday, 7 November 2018 20:20:46 UTC+5:30, Dennis Alabi wrote:
>> 
>>     django.setup()
>>   File 
>> "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py", 
>> line 24, in setup
>>     apps.populate(settings.INSTALLED_APPS)
>>   File 
>> "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py",
>>  line 112, in populate
>>     app_config.import_models()
>>   File 
>> "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py",
>>  line 198, in import_models
>>     self.models_module = import_module(models_module_name)
>>   File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py", 
>> line 126, in import_module
>>     return _bootstrap._gcd_import(name[level:], package, level)
>>   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
>>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>>   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
>>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>>   File "<frozen importlib._bootstrap_external>", line 674, in exec_module
>>   File "<frozen importlib._bootstrap_external>", line 781, in get_code
>>   File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
>>   File "<frozen importlib._bootstrap>", line 219, in 
>> _call_with_frames_removed
>>   File 
>> "C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py",
>>  line 85
>>     on_delete=models.CASCADE,related_name="'zone's", null=True, 
>> related_name='children'
>>                                                                ^
>> SyntaxError: keyword argument repeated
>> 
>> 
>> I get the above error and the potion of my code causing it in models.py is 
>> given below, please help out
>> 
>> # Relationship Fields
>>     user = ForeignKey(
>>         'customers.User',
>>         on_delete=models.CASCADE, related_name="users"
>>     )
>>     parent = ForeignKey(
>>         'customers.Zone',
>>         on_delete=models.CASCADE, related_name="'zone's", null=True, 
>> related_name='children'
>>     )
>> 
> 
> -- 
> 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/95dffaa5-a961-483e-b946-d870757c76f0%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/8C827210-1EC5-4BA5-89CC-6A1B841126A7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to