InlineFormset Factory Django Not Uploading Image

2020-03-09 Thread manas srivastava
I am trying to make an inlineforms through django. I have made a model to 
save the uploaded Image. Unfortunately the image is not getting uploaded 
through the form. I am not able to track why the image is not getting saved 
in the folder.

models.py  - This file contains all the models.
```
class courses(models.Model):
name  = models.CharField(max_length = 50)


class topics(models.Model):
name  = models.CharField(max_length = 50)
sno   = models.PositiveIntegerField(default = 0)
course = models.ForeignKey(courses,on_delete = models.CASCADE,null = 
True)

class sub_topics(models.Model):
name  = models.CharField(max_length = 50)
content = models.TextField(null = True)
sno   = models.PositiveIntegerField(default = 0)
image = models.ImageField(upload_to=('images/'),blank=  True,null = 
True)
topic = models.ForeignKey(topics,on_delete = models.CASCADE,null = True)

```

forms.py - In this file through the inlineformset_factory I have made 
courses->topics->sub_topics data base structure. The sno is use to store 
the serial number of the child forms 
```
TopicFormset = inlineformset_factory(courses, topics, 
fields=('name','sno'),extra =1,widgets = {'sno': HiddenInput()})
Sub_TopicFormset = inlineformset_factory(topics, sub_topics, 
fields=('name','content','sno','image'),extra = 1,widgets = {'sno': 
HiddenInput()})

```

views.py -  In this file I have used CreateView to display the forms 
created. While saving the results the Course and Topics are saved but while 
saving the subtopic only the character input is getting saved. The image is 
not getting saved Even after uploading the image. The image is also not 
getting saved in the media/images folder.
```
class Create_Course_View(CreateView):
model = courses
form_class = CourseForm
template_name = 'create/add.html'
success_url = 'create/add.html'

def form_valid(self, form):
result = super(Create_Course_View, self).form_valid(form)

topic_formset = TopicFormset(form.data, instance=self.object, 
prefix='topic_formset')

if topic_formset.is_valid():
topics = topic_formset.save()

topics_count = 0

for topic in topics:
sub_topic_formset = Sub_TopicFormset(form.data, instance = 
topic, prefix='sub_topic_formset_%s'% topics_count)
x = sub_topic_formset.cleaned_data
print(x[0])
if sub_topic_formset.is_valid():
sub_topic_formset.save()
topics_count += 1

return result

def get_context_data(self, **kwargs):
context = super(Create_Course_View, self).get_context_data(**kwargs)
context['topic_formset'] = TopicFormset(prefix='topic_formset')
context['sub_topic_formset'] = 
Sub_TopicFormset(prefix='sub_topic_formset_0')
return context


class upload_image(CreateView):
model = image
form_class = Upload
template_name = 'create/upload.html'

def form_valid(self, form):
result = super(upload_image, self).form_valid(form)
return result

def get_context_data(self, **kwargs):
context = super(upload_image, self).get_context_data(**kwargs)
return context

```

add.html
```
Add Course

{% csrf_token %}
{{ form.as_p }}



{{ topic_formset.management_form }}
{% for form in topic_formset %}

Topic
{{ form.as_p }}


{{ sub_topic_formset.management_form }}
{% for form in sub_topic_formset %}

Sub Topic
{{ form.as_p }}

{% endfor %}

 

{% endfor %}




```

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/97ad518e-2da3-47cd-9ce3-0983ab62a9ea%40googlegroups.com.


Re: How to create entire basic of website design without using django-admin panel

2020-03-09 Thread Omar Abou Mrad
The django admin is optional, you do not need to use it.

Start with the official django tutorial:

https://docs.djangoproject.com/en/3.0/intro/tutorial01/

On Mon, Mar 9, 2020 at 8:22 AM maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> You could go to django docs
>
>
> [image: --]
>
> Maninder Kumar
> [image: http://]about.me/maninder.s.kumar
> 
>
>
>
>
> On Fri, Feb 28, 2020 at 12:21 PM nrupesh08  wrote:
>
>>
>>
>> login page based on roles (user, admin). insert data, update data, delete
>> data in (entire rows). only particular update data in table
>> display forms in css class.  the entire page without using django
>> admin. only access front-end.
>> any reference complete project for learning. please help me. i am
>> intersted to earn 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c8d610c0-9386-424c-ad42-45849c519ab9%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABOHK3Q9HCmHp_oPtOoXszSXA7DZN5ZwwxmnT2JBF3-C5heS5A%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwtXp3u07uKiC1W63MoCz4%2BHsc1jXwmO6iUC_%3DaYjGdv6VkxQ%40mail.gmail.com.


alternative to smart_selects

2020-03-09 Thread Manos Zeakis
Hi all

I need to implement a dynamic dropdown menu field on a Model that is 
depended on another of its fields and I saw that there is smart_selects for 
that.

I installed it and followed the instructions and declared ChainedForeignKey 
but the field is finally empty.

The fields gets available values only if I choose show_all=True, but of 
course show_all=False is the way to go.

Upon searching further I saw that smart_selects itself is not maintained as 
before, a stable branch is referenced (js-unlinting-fixes) but it is not 
found anywhere.

And I could not find an alternative to this.

So, if you want to implement dynamic dropdowns, is there another way that 
you do it? Could you give me a clue?

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6a5d7d58-1b88-45e9-89fb-e96c9e8d6216%40googlegroups.com.


using two foreign keys in one django model

2020-03-09 Thread namo
i'm working on a project the scenario : teacher model can upload courses , 
then if the teacher has not a profile the institute(model) which working at 
will upload the courses does this is write way i have tried in the course
 model?

class Course(models.Model):
course_name = models.CharField(max_length=20)
student = models.ManyToMany(Student)
institute_name = models.ForeignKey(Institute,on_delete=models.CASCADE , 
null=True,blank=True)
teacher_name = models.ForeignKey(Teacher 
,on_delete=models.CASCADE,blank=True,null=True)
tags = models.ManyToManyField(Category,on_delete=models.CASCADE)
time = models.DateTimeField(auto_now_add=True)
update = models.DateTimeField(auto_now=True)

Then define:

if user loggedin in  user.is_institute

So querying in institute model

else loggedin in user.is_teacher

And then will work on teacher model. Does this structure fine ?

I've heard that generic foreign keys not working with API

from django.contrib.contenttypes.models import ContentType

note : Teacher ,Institute have different fields name 

django:2.2

Thanks

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


Django Searchfilter not functioning I don't understand why

2020-03-09 Thread mick
views.py


class UserListView(generics.ListAPIView):
 queryset = User.objects.all()
 serializer_class = UserSerializer
 filter_backends = [filters.SearchFilter,OrderingFilter,]
 search_fields = ['first_name']

 def get(self,request):
users=User.objects.all()
serializer=UserSerializer(users,many=True)
return Response(serializer.data)

 def post(self, request):
 serializer = UserSerializer(data=request.data)
 if serializer.is_valid():
 serializer.save()
 return Response(serializer.data, status=status.HTTP_201_CREATED)
 return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

 def delete(self, request, pk, format=None):
 user = self.get_object(pk)
 user.delete()
 return Response(status=status.HTTP_204_NO_CONTENT)





serializer.py



class UserSerializer(serializers.ModelSerializer):

class Meta:
model=User
fields='__all__'



models.py


class User(models.Model):
  user_id =  models.AutoField(primary_key=True)
  first_name =   models.CharField(_("Firstname"),max_length=255,null = False)
  last_name =models.CharField(_("last_name"),max_length=255,null = False)



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


Re: send free sms on phone and email to user

2020-03-09 Thread Ryan Nowakowski



On March 9, 2020 1:17:22 AM CDT, sagar ninave  wrote:
>hello community,
>
>i want to send free sms on mobile phone and email through django so how
>i 
>can do it

For email, Django has great support built-in. For SMS, I think Twilio might 
have a free tier.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/D2D69F81-B079-4858-958A-4E5123CDC9B5%40fattuba.com.


Re: using two foreign keys in one django model

2020-03-09 Thread Ryan Nowakowski



On March 9, 2020 5:13:40 AM CDT, namo  wrote:
>i'm working on a project the scenario : teacher model can upload
>courses , 
>then if the teacher has not a profile the institute(model) which
>working at 
>will upload the courses does this is write way i have tried in the
>course
> model?

When you say profile are you taking about Django's notion of a user profile?

>
>class Course(models.Model):
>course_name = models.CharField(max_length=20)
>student = models.ManyToMany(Student)
>institute_name = models.ForeignKey(Institute,on_delete=models.CASCADE ,
>null=True,blank=True)
>teacher_name = models.ForeignKey(Teacher
>,on_delete=models.CASCADE,blank=True,null=True)
>tags = models.ManyToManyField(Category,on_delete=models.CASCADE)
>time = models.DateTimeField(auto_now_add=True)
>update = models.DateTimeField(auto_now=True)

I'd rename institute_name and teacher_name to institute and teacher. That way 
you can do course.teacher.name.

>
>Then define:
>
>if user loggedin in  user.is_institute
>
>So querying in institute model
>
>else loggedin in user.is_teacher
>
>And then will work on teacher model. Does this structure fine ?

Please post the Institute and Teacher models.
Also are any if these models related to User?

>
>I've heard that generic foreign keys not working with API
>
>from django.contrib.contenttypes.models import ContentType
>
>note : Teacher ,Institute have different fields name 
>
>django:2.2
>
>Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/C87E7048-E8A5-4987-BDB6-859F8580FCCC%40fattuba.com.


CONN_MAX_AGE and Oracle

2020-03-09 Thread Dan Davis
One or my power users claims that CONN_MAX_AGE is not working properly with 
Oracle.  I've written a minimal backend to wrap the standard Oracle 
backend, and to log connection creation. I am seeing multiple connections 
sometimes in the same second with a CONN_MAX_AGE of 300.  I am currently 
attempting to discipline Phusion Passenger to use the same 2 processes for 
the length of the test, with no growth and shrinking, and we will see at 
this point.

Has anyone else seen similar issues, with Oracle especially.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d11424a8-7e3d-4ccd-9195-57c49b125cd9%40googlegroups.com.


Re: Django-React with webpack or create-react-app

2020-03-09 Thread Dan Davis
If you wish to use cache busting, or create-react-app sets that up by 
default, you can configure some special logic for loading the bundles.
Mine is per-process based, and assumes that since the bundle will be 
cached, it reasonable not to create a new static file loader:

https://gist.github.com/danizen/8d41f63c7bb4e35793a8e5d4d41fac16

On Saturday, March 7, 2020 at 5:43:06 AM UTC-5, Ronit Mishra wrote:
>
> You don't have to create a folder named 'build', `create-react-app` 
> provides you with a separate source and build directory. Once you've your 
> code ready, you just need to run `npm run build` and your source code would 
> be translated into a production-ready code in the build directory. 
>
> You can easily update any default scripts that `create-react-app` 
> provides, such as start, test or build to override the default behavior.
>
> Honestly, just dive into the documents and start getting your hands dirty 
> with coding.
>
> And If you're an advanced developer who understands working with 
> production build, then it won't be a challenging task for you to later 
> explore more configurations or packaging options for your React 
> application. 
>
> On Sat, Mar 7, 2020 at 3:30 PM Alaydyn Gholechragh  > wrote:
>
>> thanks for answer  but I think to build react from  'create-app-react' 
>> create a folder with name  'build' and I can't change it and config is hard 
>> for work them together
>>
>> On Saturday, March 7, 2020 at 1:07:44 PM UTC+3:30, Ronit Mishra wrote:
>>>
>>> Start with `creat-react-app`.. webpack and bundler are task runners that 
>>> bundle your code for production. `creat-react-app` has a bundler program 
>>> inbuilt. Once you're comfortable with React and you're easily able to 
>>> communicate between Django and React components, then you might wanna look 
>>> into improvising your production build for your react code. You should 
>>> explore external bundlers for your React application after that. 
>>>
>>> On Sat, Mar 7, 2020 at 2:52 PM Alaydyn Gholechragh  
>>> wrote:
>>>
 hi 
 I want to use Django and react together but there is one problem , I 
 don't know it is good I make react application with  "webpack and bundler 
 "  or  "creat-react-app "??

 which is better ???

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/e813b99f-1ec4-456a-8110-09be009ff4d3%40googlegroups.com
  
 
 .

>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/993da381-f9ce-4e70-a1f8-209be6585329%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/40d29fcb-2bc1-476a-b098-ad66fba2d2bd%40googlegroups.com.


Re: send free sms on phone and email to user

2020-03-09 Thread Adam Bouras
We can create an account with Twilio, which provides step-by-step to send 
text message using python.
https://www.twilio.com/docs/libraries/python

On Monday, March 9, 2020 at 1:17:22 AM UTC-5, sagar ninave wrote:

> hello community,
>
> i want to send free sms on mobile phone and email through django so how i 
> can do it
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c88439fb-2307-495c-b3ad-53d5e58f3721%40googlegroups.com.


unable to read POST parameters sent by payment gateway

2020-03-09 Thread Sreekanth


I am unable to read POST parameters sent by payment gateway after payment 
was processed. Payment gateway redirects to returnUrl (I pass this to 
payment gateway before payment was processed) with some parameters by POST 
request.

In url.py

path('cashfreeresponse/',views.cashfree_response, name='cashfree_response'),

in views.py

@csrf_exempt@login_requireddef cashfree_response(request):
print(request.method)
if request.method == "POST":
print('inside post method')
print(request.POST.get('cf_subReferenceId'))
if request.method == "GET":
print('inside get method')
print(request.GET.get('cf_subReferenceId'))

print(request.method) is showing as GET but it was supposed be POST method 
also print(request.GET.get('cf_subReferenceId')) and 
print(request.POST.get('cf_subReferenceId')) are showing as None.

But it looks like payment gateway sending parameters as POST method. When I 
pass returnUrl as http://127.0.0.1:8000/cashfreeresponse instead of 
http://127.0.0.1:8000/cashfreeresponse/ ('/' is missing in the first one) 
then I am getting error as

You called this URL via POST, but the URL doesn't end in a slash and you 
have APPEND_SLASH set. Django can't redirect to the slash URL while 
maintaining POST data. Change your form to point to 
127.0.0.1:8000/cashfreeresponse/ (note the trailing slash), or set 
APPEND_SLASH=False in your Django settings.

but I see in my google chrome page that payment gateway sending parameters 
with POST request. Below image shows parameters sent by payment gateway by 
POST request

[image: enter image description here] 

If I change urls.py to

path('cashfreeresponse',views.cashfree_response, name='cashfree_response'),

in settings.py to

APPEND_SLASH = False

and returnUrl to http://127.0.0.1:8000/cashfreeresponse then I am not 
getting any error but still not receiving any parameters. How do I read 
those parameters sent by payment gateway by POST request? Here 
 is the 
documentation for payment gateway.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bc93bd88-eecd-420e-ae86-6253676fdf12%40googlegroups.com.


activating models

2020-03-09 Thread Atıl Ardıç

I added polls app in below place;But i am getting errors while i was 
running makemigrations 

INSTALLED_APPS = [
'polls.apps.PollsConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]


C:\Users\ibrahim\Documents\Python Scripts\mart2020\mysite>py manage.py 
makemigrations polls
Traceback (most recent call last):
  File "manage.py", line 21, in 
main()
  File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
  File 
"C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py",
 
line 401, in execute_from_command_line
utility.execute()
  File 
"C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py",
 
line 377, in execute
django.setup()
  File 
"C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py",
 
line 24, in setup
apps.populate(settings.INSTALLED_APPS)
  File 
"C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py",
 
line 91, in populate
app_config = AppConfig.create(entry)
  File 
"C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py",
 
line 116, in create
mod = import_module(mod_path)
  File 
"C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 961, in _find_and_load_unlocked
  File "", line 219, in 
_call_with_frames_removed
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 970, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'polls.apps.PollsConfigdjango'; 
'polls.apps' is not a package

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


Re: activating models

2020-03-09 Thread Omar Abou Mrad
We need to see your directory structure.

meanwhile see if 'polls' works instead 'polls.apps.PollsAppConfig'

On Mon, Mar 9, 2020, 11:14 PM Atıl Ardıç  wrote:

>
> I added polls app in below place;But i am getting errors while i was
> running makemigrations
>
> INSTALLED_APPS = [
> 'polls.apps.PollsConfig'
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> ]
>
>
> C:\Users\ibrahim\Documents\Python Scripts\mart2020\mysite>py manage.py
> makemigrations polls
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File
> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py",
> line 401, in execute_from_command_line
> utility.execute()
>   File
> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py",
> line 377, in execute
> django.setup()
>   File
> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py",
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File
> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py",
> line 91, in populate
> app_config = AppConfig.create(entry)
>   File
> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py",
> line 116, in create
> mod = import_module(mod_path)
>   File
> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
> line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1014, in _gcd_import
>   File "", line 991, in _find_and_load
>   File "", line 961, in
> _find_and_load_unlocked
>   File "", line 219, in
> _call_with_frames_removed
>   File "", line 1014, in _gcd_import
>   File "", line 991, in _find_and_load
>   File "", line 970, in
> _find_and_load_unlocked
> ModuleNotFoundError: No module named 'polls.apps.PollsConfigdjango';
> 'polls.apps' is not a package
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d5c976f6-a6df-4f1e-bd77-0417d62049b2%40googlegroups.com
> 
> .
>

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


Re: activating models

2020-03-09 Thread SHANKAR JHA
I think you forget to put a comma (,) at the last.

Try using the polls and check if it's working or not.

It's best practice to put your app at the last because you want all the
package to load in first when you open your website.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
 'polls.apps.PollsConfig',
]



On Tue, Mar 10, 2020 at 11:06 AM Omar Abou Mrad 
wrote:

> We need to see your directory structure.
>
> meanwhile see if 'polls' works instead 'polls.apps.PollsAppConfig'
>
> On Mon, Mar 9, 2020, 11:14 PM Atıl Ardıç  wrote:
>
>>
>> I added polls app in below place;But i am getting errors while i was
>> running makemigrations
>>
>> INSTALLED_APPS = [
>> 'polls.apps.PollsConfig'
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> ]
>>
>>
>> C:\Users\ibrahim\Documents\Python Scripts\mart2020\mysite>py manage.py
>> makemigrations polls
>> Traceback (most recent call last):
>>   File "manage.py", line 21, in 
>> main()
>>   File "manage.py", line 17, in main
>> execute_from_command_line(sys.argv)
>>   File
>> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py",
>> line 401, in execute_from_command_line
>> utility.execute()
>>   File
>> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py",
>> line 377, in execute
>> django.setup()
>>   File
>> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py",
>> line 24, in setup
>> apps.populate(settings.INSTALLED_APPS)
>>   File
>> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py",
>> line 91, in populate
>> app_config = AppConfig.create(entry)
>>   File
>> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py",
>> line 116, in create
>> mod = import_module(mod_path)
>>   File
>> "C:\Users\ibrahim\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
>> line 127, in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 1014, in _gcd_import
>>   File "", line 991, in _find_and_load
>>   File "", line 961, in
>> _find_and_load_unlocked
>>   File "", line 219, in
>> _call_with_frames_removed
>>   File "", line 1014, in _gcd_import
>>   File "", line 991, in _find_and_load
>>   File "", line 970, in
>> _find_and_load_unlocked
>> ModuleNotFoundError: No module named 'polls.apps.PollsConfigdjango';
>> 'polls.apps' is not a package
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/d5c976f6-a6df-4f1e-bd77-0417d62049b2%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFwtXp0x8Vh7TMeyGtr2GxtqyEgEuntNWzcMn8uFngjKbitTjg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOmnpAxvZLP7Or81j-tBEAR-GUUv9WhuCnZYC-XQsqB9MeJ2gA%40mail.gmail.com.