Re: SQLite 3.8.3 or later is required (found 3.7.17).

2019-07-19 Thread anchal agarwal
This is my whole Traceback
Traceback (most recent call last):
  File "manage.py", line 15, in 
execute_from_command_line(sys.argv)
  File
"/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py",
line 381, in execute_from_command_line
utility.execute()
  File
"/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py",
line 357, in execute
django.setup()
  File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line
24, in setup
apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py",
line 114, in populate
app_config.import_models()
  File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line
211, in import_models
self.models_module = import_module(models_module_name)
  File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 967, in _find_and_load_unlocked
  File "", line 677, in _load_unlocked
  File "", line 728, in exec_module
  File "", line 219, in
_call_with_frames_removed
  File "/home/ec2-user/wavybeatz/music/models.py", line 4, in 
class Album(models.Model):
  File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py",
line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
  File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py",
line 321, in add_to_class
value.contribute_to_class(cls, name)
  File
"/usr/local/lib/python3.7/site-packages/django/db/models/options.py", line
204, in contribute_to_class
self.db_table = truncate_name(self.db_table,
connection.ops.max_name_length())
  File "/usr/local/lib/python3.7/site-packages/django/db/__init__.py", line
28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line
201, in __getitem__
backend = load_backend(db['ENGINE'])
  File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line
110, in load_backend
return import_module('%s.base' % backend_name)
  File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 967, in _find_and_load_unlocked
  File "", line 677, in _load_unlocked
  File "", line 728, in exec_module
  File "", line 219, in
_call_with_frames_removed
  File
"/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
line 66, in 
check_sqlite_version()
  File
"/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
line 63, in check_sqlite_version
raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found
%s).' % Database.sqlite_version)
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is
required (found 3.7.17).

On Sat, Jul 20, 2019 at 12:29 AM anchal agarwal 
wrote:

> I used default sqlite as my Database
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> }
> }
> My python version is python3 and Django version is 2.1.5
>
> On Fri, Jul 19, 2019 at 7:06 PM Desh Deepak 
> wrote:
>
>> Hi, show me your database connection, also tell me python and Django
>> version.
>>
>>
>> On Fri, 19 Jul 2019, 18:06 anchal agarwal, 
>> wrote:
>>
>>> Hello Django users,
>>> i am trying to deploy my django on AWS
>>> I am following this
>>> https://medium.com/@charlesthk/deploy-nginx-django-uwsgi-on-aws-ec2-amazon-linux-517a683163c6
>>> Everything was going right but when i run python manage.py migrate ,
>>> it's giving me this error
>>> django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is
>>> required (found 3.7.17).
>>> how can i resolve this?
>>> 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.googl

Re: SQLite 3.8.3 or later is required (found 3.7.17).

2019-07-19 Thread anchal agarwal
I used default sqlite as my Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
My python version is python3 and Django version is 2.1.5

On Fri, Jul 19, 2019 at 7:06 PM Desh Deepak  wrote:

> Hi, show me your database connection, also tell me python and Django
> version.
>
>
> On Fri, 19 Jul 2019, 18:06 anchal agarwal, 
> wrote:
>
>> Hello Django users,
>> i am trying to deploy my django on AWS
>> I am following this
>> https://medium.com/@charlesthk/deploy-nginx-django-uwsgi-on-aws-ec2-amazon-linux-517a683163c6
>> Everything was going right but when i run python manage.py migrate , it's
>> giving me this error
>> django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is
>> required (found 3.7.17).
>> how can i resolve this?
>> 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/CAMT%3DisVCsYAju5agUWxPrpjZ5a-NGc1X0A7U34c4QthnAM0jKA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisVCsYAju5agUWxPrpjZ5a-NGc1X0A7U34c4QthnAM0jKA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/CAJ0m4xiKUd3sOH0mwJtsUKS-mO8w4hok6VmKoS%3DFEbaSJ9XSag%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJ0m4xiKUd3sOH0mwJtsUKS-mO8w4hok6VmKoS%3DFEbaSJ9XSag%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMT%3DisX2o05%2BnyhNayzzL0x1xYK2%2BLz%3DS6k%3DaDiBXB%3DKwkzo8A%40mail.gmail.com.


SQLite 3.8.3 or later is required (found 3.7.17).

2019-07-19 Thread anchal agarwal
Hello Django users,
i am trying to deploy my django on AWS
I am following this
https://medium.com/@charlesthk/deploy-nginx-django-uwsgi-on-aws-ec2-amazon-linux-517a683163c6
Everything was going right but when i run python manage.py migrate , it's
giving me this error
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is
required (found 3.7.17).
how can i resolve this?
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/CAMT%3DisVCsYAju5agUWxPrpjZ5a-NGc1X0A7U34c4QthnAM0jKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10: ''

2019-06-21 Thread anchal agarwal
Hello lutalo
I am also facing the same issue. If you find any solution please let me
know . It would be very helpful.
Thank you
hi guys, am working on an ecommerce system, which has cart as an app, but i
keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

-- 
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%
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/CAMT%3DisUkQszjKE0GjvQsi5czm77wbfjd906w8kepKd4nXFv--Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ValueError at /admin/

2019-06-16 Thread anchal agarwal
I removed all files,and when i applied migrations it's showing me this
C:\Users\User\Desktop\mysite>python manage.py makemigrations
System check identified some issues:

WARNINGS:
?: (urls.W005) URL namespace 'music' isn't unique. You may not be able to
reverse all URLs in this namespace
Migrations for 'music':
  music\migrations\0001_initial.py
- Create model Album
- Create model Song

C:\Users\User\Desktop\mysite>python manage.py migrate
System check identified some issues:

WARNINGS:
?: (urls.W005) URL namespace 'music' isn't unique. You may not be able to
reverse all URLs in this namespace
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, music, sessions
Running migrations:
  No migrations to apply.



On Sun, Jun 16, 2019 at 7:16 PM Sai Praneeth  wrote:

> Remove files in migration folder and then try to migrate
>
> On Sun 16 Jun, 2019, 1:38 PM anchal agarwal, 
> wrote:
>
>> I recently deleted one of my app from my website directory. For deleting
>> app I removed that app name from settings.py also I removed it's folder
>> I then applied python manage.py migrate
>> But now i am unable to access my admin, it's giving an error
>>
>> ValueError: invalid literal for int() with base 10: 'admin'
>>
>> Internal Server Error: /favicon.ico/
>> Any help would be greatly appreciated
>>
>>
>> --
>> 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/CAMT%3DisX4EEYjRDG0REECdjmKFiYvex8dHHdM9szqqSAyT%3Dd3pg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisX4EEYjRDG0REECdjmKFiYvex8dHHdM9szqqSAyT%3Dd3pg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/CAGKB3nTe6tEFB7DHFA85JsTLvFU9Di1siKekDqx8hrxmUH2SVQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGKB3nTe6tEFB7DHFA85JsTLvFU9Di1siKekDqx8hrxmUH2SVQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisV2FzLQH6AuzQLA1yYSu4iec19pL5j%2BakKXAyrYXGkb5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ValueError at /admin/

2019-06-16 Thread anchal agarwal
here is my urls.py . I only need music app.
from django.contrib import admin
from django.urls import path,include
from . import settings
from django.contrib.staticfiles.urls import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
path('',include('music.urls')),
path('music/',include('music.urls')),
path('admin/', admin.site.urls),
]
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


No, I don't have copy of urls.py of deleted app.  How can I resolve this?

On Sun, Jun 16, 2019 at 3:57 PM Dave Edwards  wrote:

> What's in your urls.py at the project level? Do you have a copy of the
> urls.py that sit within the deleted app folder?
>
> On Sun, 16 Jun 2019, 09:09 anchal agarwal, 
> wrote:
>
>> I recently deleted one of my app from my website directory. For deleting
>> app I removed that app name from settings.py also I removed it's folder
>> I then applied python manage.py migrate
>> But now i am unable to access my admin, it's giving an error
>>
>> ValueError: invalid literal for int() with base 10: 'admin'
>>
>> Internal Server Error: /favicon.ico/
>> Any help would be greatly appreciated
>>
>>
>> --
>> 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/CAMT%3DisX4EEYjRDG0REECdjmKFiYvex8dHHdM9szqqSAyT%3Dd3pg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisX4EEYjRDG0REECdjmKFiYvex8dHHdM9szqqSAyT%3Dd3pg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/CAP_enV6LHhQqgge-2bfyZCyQRmoFKKta0EV8k4DUH-ZJioQvkA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAP_enV6LHhQqgge-2bfyZCyQRmoFKKta0EV8k4DUH-ZJioQvkA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisXO8xsj-B3a3-gbdyEwy8m-17UWmfHkFJWv7sQdNrG%2Bxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ValueError at /admin/

2019-06-16 Thread anchal agarwal
It's still showing the same error , is there any other way to resolve this
issue ?
On 16-Jun-2019 1:57 pm, "Karan Mittal"  wrote:

> You can try the sequence of commands,
> Makemigrations
> Migrate
> It solved the problem for me.
> Karan Mittal
>
> On Sun 16 Jun, 2019, 1:38 PM anchal agarwal, 
> wrote:
>
>> I recently deleted one of my app from my website directory. For deleting
>> app I removed that app name from settings.py also I removed it's folder
>> I then applied python manage.py migrate
>> But now i am unable to access my admin, it's giving an error
>>
>> ValueError: invalid literal for int() with base 10: 'admin'
>>
>> Internal Server Error: /favicon.ico/
>> Any help would be greatly appreciated
>>
>>
>> --
>> 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/CAMT%3DisX4EEYjRDG0REECdjmKFiYvex8d
>> HHdM9szqqSAyT%3Dd3pg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisX4EEYjRDG0REECdjmKFiYvex8dHHdM9szqqSAyT%3Dd3pg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/CAO24gqyJgewLDosU2kOSgfmngU0Ni
> YD2h4yUB_tAOhrw%2Be%3DACQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO24gqyJgewLDosU2kOSgfmngU0NiYD2h4yUB_tAOhrw%2Be%3DACQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisVVPHzoUT0t_HDnRnnMPhKtPuJbhFFGp5N295HqH5xXtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ValueError at /admin/

2019-06-16 Thread anchal agarwal
I recently deleted one of my app from my website directory. For deleting
app I removed that app name from settings.py also I removed it's folder
I then applied python manage.py migrate
But now i am unable to access my admin, it's giving an error

ValueError: invalid literal for int() with base 10: 'admin'

Internal Server Error: /favicon.ico/
Any help would be greatly appreciated

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


Re: user Form error

2019-06-07 Thread anchal agarwal
Thanks Chetan ...It worked !!
On 07-Jun-2019 1:23 am, "Chetan Ganji"  wrote:

Hi Anchal

PFA
https://stackoverflow.com/questions/9061846/attributeerror-at-
registration-userform-object-has-no-attribute-save

.save() method is available on forms.ModelForm; not on forms.Form

Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Fri, Jun 7, 2019 at 12:02 AM terry frank  wrote:

> Hello,  from which repos ?
>
> On Thu, Jun 6, 2019 at 7:50 PM anchal agarwal 
> wrote:
>
>> Hello,
>> I am making a simple user form but my form data is not saving.It is
>> showing this error
>> 'UserForm' object has no attribute 'save'
>> Here is my code. Please tell me where i am wrong
>> views.py
>> class UserFormView(View):
>> form_class=UserForm
>> template_name='music/registration_form.html'
>>
>> #display blank form
>> def get(self , request):
>> form=self.form_class(None)
>> return render(request,self.template_name,{'form':form})
>>
>> #process from data
>> def post(self, request):
>> form=self.form_class(request.POST)
>>
>> if form.is_valid():
>> user=form.save(commit=False)
>>
>> #cleaned (normalized) data
>> username=form.cleaned_data['username']
>> password=form.cleaned_data['password']
>> user.set_password(password)
>> user.save()
>>
>> #returns User objects if credentials are correct
>>
>> user=authenticate(username=username,password=password)
>>
>> if user is not None:
>>
>> if user.is_active:
>> login(request,user)
>> return redirect('music:index')
>> return render(request,self.template_name,{'form':form})
>>
>> forms.py
>> from django import forms
>> from django.contrib.auth.models import User
>>
>> class UserForm(forms.Form):
>> password=forms.CharField(wiget = forms.PasswordInput)
>> class Meta:
>> model=User
>> fields=['username','email','password']
>>
>> --
>> 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/CAMT%3DisXLE0z7ADcBzB-LhDf%2BU9_
>> ZNVrhitBAVrSDwQCSKEfNZg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisXLE0z7ADcBzB-LhDf%2BU9_ZNVrhitBAVrSDwQCSKEfNZg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/CACGjKra8_nF%2BcymQogX9Y0iQbNt0nG9mLWv6kfB_
> 4OVJB-HC1Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACGjKra8_nF%2BcymQogX9Y0iQbNt0nG9mLWv6kfB_4OVJB-HC1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMKMUjvyOVUrjO-X-iAQE4UwhEzOvMBtwryj0iy7xZceQmx
guw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMKMUjvyOVUrjO-X-iAQE4UwhEzOvMBtwryj0iy7xZceQmxguw%40mail.gmail.com?utm_medium=email&utm_source=footer>
.

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/CAMT%3DisWv%2BP%3Dwp4g78KZh9P0UZCUBD2mLwrypkC0oLXEAcABZcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


user Form error

2019-06-06 Thread anchal agarwal
Hello,
I am making a simple user form but my form data is not saving.It is showing
this error
'UserForm' object has no attribute 'save'
Here is my code. Please tell me where i am wrong
views.py
class UserFormView(View):
form_class=UserForm
template_name='music/registration_form.html'

#display blank form
def get(self , request):
form=self.form_class(None)
return render(request,self.template_name,{'form':form})

#process from data
def post(self, request):
form=self.form_class(request.POST)

if form.is_valid():
user=form.save(commit=False)

#cleaned (normalized) data
username=form.cleaned_data['username']
password=form.cleaned_data['password']
user.set_password(password)
user.save()

#returns User objects if credentials are correct

user=authenticate(username=username,password=password)

if user is not None:

if user.is_active:
login(request,user)
return redirect('music:index')
return render(request,self.template_name,{'form':form})

forms.py
from django import forms
from django.contrib.auth.models import User

class UserForm(forms.Form):
password=forms.CharField(wiget = forms.PasswordInput)
class Meta:
model=User
fields=['username','email','password']

-- 
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/CAMT%3DisXLE0z7ADcBzB-LhDf%2BU9_ZNVrhitBAVrSDwQCSKEfNZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: TemplateSyntaxError

2019-06-02 Thread anchal agarwal
You were rightthe error resolved when I removed curly braces from the
if statement. Thanks alot !!
On 01-Jun-2019 11:26 am, "sagar ninave"  wrote:

> you do not have ended for loop
>
> On Fri, May 31, 2019 at 7:41 PM anchal agarwal 
> wrote:
>
>> I am creating a simple form in which when a user will select a particular
>> song and press Favorite button a star image will get pop up in front of
>> that song.
>> But it is showing TemplateSyntaxError.
>> Please correct me where I am wrong
>> here is my template
>> 
>>
>> {{ album.album_title}}
>> {{ album.artist }}
>>
>> {% if error_message %}
>> {{ error_message }}
>> {% endif %}
>>
>> 
>> {% csrf_token %}
>> {% for song in album.song_set.all %}
>> 
>> 
>> {{ song.song_title }}
>> {{% if song.is_favorite %}}
>> http://i.imgur.com/b9b13Rd.png";>
>> {{% endif %}}
>> 
>> 
>> 
>>
>> --
>> 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/CAMT%3DisUed7dkD%2BPCgis7bBZSAveti1Wy4WgNSoPA7D
>> m6kKLO3A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisUed7dkD%2BPCgis7bBZSAveti1Wy4WgNSoPA7Dm6kKLO3A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> <https://about.me/sagarninave?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb>
> sagar ninave
> about.me/sagarninave
> <https://about.me/sagarninave?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb>
>
> --
> 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/CAA6pdZ-yw6hsS7aOj4czvEY5uCeb5NdYOuUiY
> 50SvGvhyPA5_g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAA6pdZ-yw6hsS7aOj4czvEY5uCeb5NdYOuUiY50SvGvhyPA5_g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisXQdR2fvYbE-vGhOZVMrnqWvpXR5Rb%3D3XXF6a5Fi8RiqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


TemplateSyntaxError

2019-05-31 Thread anchal agarwal
I am creating a simple form in which when a user will select a particular
song and press Favorite button a star image will get pop up in front of
that song.
But it is showing TemplateSyntaxError.
Please correct me where I am wrong
here is my template


{{ album.album_title}}
{{ album.artist }}

{% if error_message %}
{{ error_message }}
{% endif %}


{% csrf_token %}
{% for song in album.song_set.all %}


{{ song.song_title }}
{{% if song.is_favorite %}}
http://i.imgur.com/b9b13Rd.png";>
{{% endif %}}




-- 
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/CAMT%3DisUed7dkD%2BPCgis7bBZSAveti1Wy4WgNSoPA7Dm6kKLO3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display image in template

2019-05-28 Thread anchal agarwal
Thanks Nitin. It worked !!

-- 
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/CAMT%3DisWznPc66tv%3D_7q0R9mVdDh8VBh%2BZ5MWFxAwEeZmLwzyRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display image in template

2019-05-28 Thread anchal agarwal
Thanks for the answer but  I have already set the MEDIA path
here is my urls.py
from . import settings
from django.contrib.staticfiles.urls import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

models.py
from django.db import models

class Album(models.Model):
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre=models.CharField(max_length=100)
album_logo = models.ImageField(upload_to="gallery")

def __str__(self):
return self.album_title


 settings.py
import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

MEDIA_ROOT=os.path.join(BASE_DIR,'media')
MEDIA_URL= '/media/'

On Tue, May 28, 2019 at 11:42 PM Anirudh Jain 
wrote:

> You will have to setup MEDIA path f8rst. All your uploded files will be
> stored in that folder. STATIC path is used only for, well, static content
> like css and js.
>
> On Tue, 28 May 2019, 23:31 anchal agarwal, 
> wrote:
>
>> I want to display image dynamically from the database in a django
>> template. I have used ImageField for this purpose. The code shows no error
>> but it is only displaying an icon of image.
>> This is my template file,
>> here album is the context and album_logo is the variable in which i have
>> stored my image. please tell me how can i fix this issue
>> 
>>
>> {{ album.album_title}}
>> {{ album.artist }}
>>
>> 
>> {% for song in album.song_set.all %}
>> {{song.song_title}}-{{song.file_type}}
>> {% 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 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/CAMT%3DisWxuO9d1tTMacyYauDAmQS%2B2e_B9HawfZP7eY8smCS%3D2Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMT%3DisWxuO9d1tTMacyYauDAmQS%2B2e_B9HawfZP7eY8smCS%3D2Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/CAC3mK7fGps2XR1S7V%2B4WvU-%2Boma-eoUTrtDjEwVJe2QtCTL_Xg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAC3mK7fGps2XR1S7V%2B4WvU-%2Boma-eoUTrtDjEwVJe2QtCTL_Xg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisWvaOt-NYXGa-Ps5yO7b-bbTfi3%3Dii4wzQmzVCOH%3DO50A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Display image in template

2019-05-28 Thread anchal agarwal
I want to display image dynamically from the database in a django template.
I have used ImageField for this purpose. The code shows no error but it is
only displaying an icon of image.
This is my template file,
here album is the context and album_logo is the variable in which i have
stored my image. please tell me how can i fix this issue


{{ album.album_title}}
{{ album.artist }}


{% for song in album.song_set.all %}
{{song.song_title}}-{{song.file_type}}
{% 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 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/CAMT%3DisWxuO9d1tTMacyYauDAmQS%2B2e_B9HawfZP7eY8smCS%3D2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: URL conf error

2019-05-28 Thread anchal agarwal
which version of django you are using?

i think it should be url(r'^$', views.index, name=index)

On Tue, May 28, 2019 at 11:01 PM Madhur Kabra 
wrote:

> I am getting the url conf error. I  have attached the relevant files.
> Thanks for the assistance
>
> --
> 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/37eedb50-637a-45bf-839a-cbe52a410f4e%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/CAMT%3DisXVTCf1oSHS0s_JTpo3AZc2OFpNkO0U9WOExTTZNPS1Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get object id from database?

2019-05-25 Thread anchal agarwal
Thanks . It worked !!
On 26-May-2019 5:05 am, "Rob Gmail"  wrote:

> Look at the new Boston.com he did a tutorial on exactly this issue
>
> Rob
> 203-671-6514
> Sent from my mobile device, please excuse the typos.
>
> On May 25, 2019, at 7:25 PM, Yoo  wrote:
>
> Maybe try album__id (two underscores)? Or try album_title as defined in
> the Album model. I also advise not to expose your primary key in the URL.
> If the above did not work, check Django  documentation: https://docs.
> djangoproject.com/en/2.2/topics/http/urls/
>
> On Saturday, May 25, 2019 at 2:46:58 PM UTC-4, Anchal Agarwal wrote:
>>
>> I am currently working on a django project in which there is a music app.
>> The models of this app contains Albums and Songs. I want to return the http
>> response when the django receives a url as /music/712 , here 712 is the
>> object id.
>> Please help me out in resolving the issue.Thanks in advance.
>>
>> Here are my files. Here album_id will be the id of the object.
>> models.py
>> from django.db import models
>>
>> class Album(models.Model):
>> artist = models.CharField(max_length=250)
>> album_title = models.CharField(max_length=500)
>> genre=models.CharField(max_length=100)
>> album_logo = models.CharField(max_length=1000)
>>
>> def __str__(self):
>> return self.album_title
>>
>> class Song(models.Model):
>> album= models.ForeignKey(Album, on_delete=models.CASCADE)
>> file_type= models.CharField(max_length=10)
>> song_title = models.CharField(max_length=250)
>>
>> views.py
>> from django.shortcuts import render
>> from django.http import HttpResponse
>>
>> def homepage(request):
>> return HttpResponse("You are looking music!!")
>>
>> def detail(request, album_id):
>> return HttpResponse("Details for Album id:"+ str(album_id)+ "")
>>
>> urls.py
>>
>> from django.urls import path
>> from . import views
>>
>> app_name="music"
>>
>> urlpatterns=[
>> #/music/
>> path('',views.homepage,name='homepage'),
>>
>> # /music/712
>> path('[0-9]+/',views.detail,name='detail'),
>> ]
>>
> --
> 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/848dc27b-9d4c-42a1-a691-c74ac4112e41%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/848dc27b-9d4c-42a1-a691-c74ac4112e41%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/01D40376-A294-48D1-AD09-47C6A3E25C6B%40gmail.com
> <https://groups.google.com/d/msgid/django-users/01D40376-A294-48D1-AD09-47C6A3E25C6B%40gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisVTE9eLL-foxO57Zwcgk1Lg6zKtm2TeoayYpjEt6gRzJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to get object id from database?

2019-05-25 Thread anchal agarwal
I am currently working on a django project in which there is a music app.
The models of this app contains Albums and Songs. I want to return the http
response when the django receives a url as /music/712 , here 712 is the
object id.
Please help me out in resolving the issue.Thanks in advance.

Here are my files. Here album_id will be the id of the object.
models.py
from django.db import models

class Album(models.Model):
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre=models.CharField(max_length=100)
album_logo = models.CharField(max_length=1000)

def __str__(self):
return self.album_title

class Song(models.Model):
album= models.ForeignKey(Album, on_delete=models.CASCADE)
file_type= models.CharField(max_length=10)
song_title = models.CharField(max_length=250)

views.py
from django.shortcuts import render
from django.http import HttpResponse

def homepage(request):
return HttpResponse("You are looking music!!")

def detail(request, album_id):
return HttpResponse("Details for Album id:"+ str(album_id)+ "")

urls.py

from django.urls import path
from . import views

app_name="music"

urlpatterns=[
#/music/
path('',views.homepage,name='homepage'),

# /music/712
path('[0-9]+/',views.detail,name='detail'),
]

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


Re: Print data from Database in Django

2019-05-05 Thread anchal agarwal
Thanks alot , it worked !!
On 05-May-2019 7:43 pm, "Thomas Lockhart"  wrote:

> Your context variable for all students is “stud”. Try changing that to
> “Student” as you refer to it in your template.
>
> - Tom
>
> On May 5, 2019, at 7:09 AM, anchal agarwal 
> wrote:
>
> I want to display the name of all the students from the Student model
> using cards , i have set it all up but it isn't displaying anything, here
> are my files
>
> models.py
>
> from django.db import models
> from django.utils import timezone
> from datetime import date
> from ckeditor.fields import RichTextField
>
> class Student(models.Model):
> full_name=models.CharField(max_length=70)
> D_O_B=models.TextField()
> def _str_(self):
> return self.full_name
>
> class Article(models.Model):
> pub_date=models.DateField(default=timezone.now())
> headline=models.CharField(max_length=70)
> content=RichTextField()
> reporter=models.ForeignKey(Student,on_delete=models.CASCADE)
>
>
> urls.py
>
> from django.urls import path
> from . import views
>
> app_name="students"
>
> urlpatterns=[
> path('Students.html/',views.homepage,name='homepage'),
> path("/",views.detail,name='detail'), ]
>
>
> views.py
>
> from django.shortcuts import render
> from django.http import HttpResponse
> from .models import Student
>
> def homepage(request):
> context={"stud": Student.objects.all}
> print(Student.objects.all)
> return render(request,"students/Students.html",context)
>
> def detail(request,full_name):
> return HttpResponse("You are looking %s!!" % full_name)
>
> Students.html
> 
> 
> https://cdnjs.cloudflare.com/ajax/libs/
> materialize/1.0.0/css/materialize.min.css">
> 
> https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0</a>.
> 0/js/materialize.min.js">
> 
> 
> 
> {% for stud in Student %}
> 
> 
> 
> {{stud.full_name}}
> {{stud.D_O_B}}
> 
> 
> This is a link
> This is a link
> 
> 
> 
> {% 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 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/CAMT%3DisXCa7Yc-vM3%2B5c0jWdCX8hgwJFN2tRtCqkK2Nbzz
> qX-nA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMT%3DisXCa7Yc-vM3%2B5c0jWdCX8hgwJFN2tRtCqkK2NbzzqX-nA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/ECEE1C89-29E7-45D7-A7F0-DCBE7DB4CE66%40gmail.com
> <https://groups.google.com/d/msgid/django-users/ECEE1C89-29E7-45D7-A7F0-DCBE7DB4CE66%40gmail.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMT%3DisWvQpqUeTf24J_RKzPZTN%3DJKrMxDHedEnAXoEEWhS%2BdKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Print data from Database in Django

2019-05-05 Thread anchal agarwal
I want to display the name of all the students from the Student model using
cards , i have set it all up but it isn't displaying anything, here are my
files

models.py

from django.db import models
from django.utils import timezone
from datetime import date
from ckeditor.fields import RichTextField

class Student(models.Model):
full_name=models.CharField(max_length=70)
D_O_B=models.TextField()
def _str_(self):
return self.full_name

class Article(models.Model):
pub_date=models.DateField(default=timezone.now())
headline=models.CharField(max_length=70)
content=RichTextField()
reporter=models.ForeignKey(Student,on_delete=models.CASCADE)


urls.py

from django.urls import path
from . import views

app_name="students"

urlpatterns=[
path('Students.html/',views.homepage,name='homepage'),
path("/",views.detail,name='detail'), ]


views.py

from django.shortcuts import render
from django.http import HttpResponse
from .models import Student

def homepage(request):
context={"stud": Student.objects.all}
print(Student.objects.all)
return render(request,"students/Students.html",context)

def detail(request,full_name):
return HttpResponse("You are looking %s!!" % full_name)

Students.html


https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css
">

https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js
">



{% for stud in Student %}



{{stud.full_name}}
{{stud.D_O_B}}


This is a link
This is a link



{% 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 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/CAMT%3DisXCa7Yc-vM3%2B5c0jWdCX8hgwJFN2tRtCqkK2NbzzqX-nA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: help with URLS.PY

2019-05-03 Thread anchal agarwal
I am also facing the same issue ,can you tell me how you resolved this
issue?
On 03-May-2019 9:57 pm,  wrote:
>
> I resolved this.
>
>
> On Thursday, May 2, 2019 at 5:21:59 PM UTC-4, randmw...@gmail.com wrote:
>>
>> new to django. so i have an app that displays an html page. i also have
a menu on that page that will load up other html pages.
>> however, when i add the path to urls.py and then the class def in views,
it fails. i know it's something simple, what am i missing.
>>
>> As I said, the dashboard.html works, i just want another menu option to
load the other html file. i have commented this out as it causes my app to
break.
>>
>>
>>
>> urls.py
>>
>> from django.conf.urls import url
>> from django.contrib import admin
>> from django.urls import path
>>
>> from vr_reporting_app.views import HomeView
>> from vr_reporting_app.views import Map
>>
>> urlpatterns = [
>> path('', HomeView.as_view(), name='home'),#points to the view in
views.py
>> #path('map/', Map.as_view(), name='map'),

>> path('admin/', admin.site.urls),
>> ]
>>
>>
>> views.py
>>
>> from django.shortcuts import render
>> from django.views.generic.base import TemplateView
>>
>> class HomeView(TemplateView):
>> template_name = 'dashboard.html'
>>
>> class Map(TemplateView):
>> template_name = 'map.html'
>
> --
> 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/1e5029d2-a431-4c60-95ec-5ffedb11c124%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/CAMT%3DisXmbb6S1S6jjkowmgPfKjCYtF%2BPyYca9kOA5ZAdyi23zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.