cj
Bhai i wanted to learn to learn Django from very basic of MVT , please help me , whenever i visit youtube turorils they just startvas if i knew MVT . Please suggest some good content where i can learn from scratch.
And forget that MVT stuff, django's developers don't even consider it as MVT, they just let you use it if you really want to use some acronyms, but it's not the pattern they meant django to be... go read https://docs.djangoproject.com/en/2.0/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names
Django Bot
>> Links - Two Scoops of Django 1.11: Best Practices for the Django Web Framework – Tw - Django Book: How to Tango with Django: A Python Django Tutorial
inchidi
https://docs.djangoproject.com/en/2.0/ref/contrib/contenttypes/#generic-relations
hmm i never use it, but i think nested serializer is what you're looking for
N S
Which is the best library to import csv files to models
inchidi
python has built in for that too btw https://docs.python.org/2/library/csv.html
Cool
Error in url pattern not in view
Cool
Show your urls file
Cool
Once try repath or url(r'^login/$', View.login_view)
Cool
Use something like this
Cool
Don't worry url will work
Meera
from django.urls import path from . import views app_name = 'accounts' urlpatterns = [ path('signup/', views.signup_view, name="signup"), path(r'^login/$', views.login_view, name="login"), ]
Meera
Don't worry url will work
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/accounts/login/
Meera
is django 2.1 is unstable or under developmetn?
Mirco
It's been released today as stable
Mirco
2.2 is under dev
@&!
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/accounts/login/
if you work with generic class you need LoginView.as_view() or function only login_view without as_view()
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
hmm i never use it, but i think nested serializer is what you're looking for
I tried the nested serialization for the images and tested it and got a {"other_data": "", "images": "<django.contrib.contenttypes.fields.GenericRelatedObjectManager object"}
cj
looks like your'e triggering a GET action instead a POST action
cj
do you have /accounts/ registered in main urls.py file? so django will know you have an /accounts/login/ url, otherwise django will only know /login/ account
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
hows your serializer?
class ArticleSerializer(serializers.ModelSerializer): images = ImageSerializer(many=True) class Meta: model = Article fields = ('article fields', 'images')
Cool
Roberto: from django.urls import path from . import views app_name = 'accounts' urlpatterns = [ path('signup/', views.signup_view, name="signup"), url(r'^login/$', views.login_view, name="login"), ]
Cool
Use url not path
cj
Use url not path
path is new in Django 2.0+, it's cleaner and simpler than url, both are valid anyway
Anonymous
path is more flexible than URL, I prefer it
Milan
path is new in Django 2.0+, it's cleaner and simpler than url, both are valid anyway
Although you can also use re_path instead of url in django 2
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
whats the Meta.model of ImageSerializer?
Image(modela.Model): image = ImageField() content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id')
cj
Although you can also use re_path instead of url in django 2
but path is cleaner and simpler... https://docs.djangoproject.com/en/2.0/ref/urls/
cj
👍
Rohan
Oh wait it's article serializer
Anonymous
Tmrw i talk with this group admin. THANKS to them i moved from sqllite . Now Question arised from my research PostgreSql is great but it is for heavy applications, i m making apis of personal use or to learn . So, which should i choose Postgres or My SQL.
Anonymous
Hey DjangoPeople, i m facing errors in configuring mysql . So, Can anybody guide me to configure it or a link for help.
Cool
Create a mysql database and declare in settings.py file
cj
Tmrw i talk with this group admin. THANKS to them i moved from sqllite . Now Question arised from my research PostgreSql is great but it is for heavy applications, i m making apis of personal use or to learn . So, which should i choose Postgres or My SQL.
PostgreSQL without doubt, I have to say PostgreSQL has less resource consumption than MySQL, forget that what you read is for heavy applications, you can use PostgreSQL for any kind of applications you want, even if it's a small one
cj
and Django works better with PostgreSQL, even it has some great functions that works only with PostgreSQL and make your life easier
Jimmies San
postgres is better :D
shiitakePLπŸ‡΅πŸ‡±
postgres, rabbit, elasticsearch, mongo, redis....all depend what do U doing
Anonymous
Thanks Guys
Anonymous
I ll accepted your all advice for PostgresSql
Anonymous
As i m new so i wanted the taste of all so i can realy feel the difference. I m making an api so i decided lets move and try another db.
Anonymous
Now i m shifted to PostGresSql
Anonymous
Thanks Admin and GroupMembers
Anonymous
😂Djangopeople
Man we all are django people
Anonymous
👍
Anonymous
I have implemented Array-Field, but at serialization Class Fields i m getting error Field name is not valid for Model . link to PasteBin https://pastebin.com/UQk3hAZ8
Anonymous
https://pastebin.com/FrZ7qrhd For Model and Serializer class
Django Bot
>> Links - Django 2.1 released | Hacker News
Cool
Yes
Vospitan
Π‘ΡƒΠΏΠ΅Ρ€
Anonymous
ProgrammingError at myModel : realtion does not exsist But all being done is error free. Please Help me on it.
cj
ProgrammingError at myModel : realtion does not exsist But all being done is error free. Please Help me on it.
if software tells you that you have an error, it's because you have an error... 🙄
cj
ProgrammingError at myModel : realtion does not exsist But all being done is error free. Please Help me on it.
besides you don't tell more details, don't show your code and don't tell what you are doing/what you expect, nobody can use a magic ball to help you
Anonymous
This time i tried to ask is anybody online now. Because last time i provide all nobody responded give me a second ill share my model
Anonymous
class StudentModel(models.Model): created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) student_name = models.CharField(max_length=40, blank=False, help_text='Name Restricted to 40 Characters long') student_college = models.CharField(max_length=200, blank=False) student_emailID = models.EmailField(blank=False) student_number = models.PositiveIntegerField(blank=False)
Anonymous
This is the model gving me error
cj
This is the model gving me error
you don't provide the error message you get, and what did you do to get the error 🤷🏻‍♂️ it's still useless to help you
Anonymous
Okay i m giving the traceback
Anonymous
https://pastebin.com/7uakTbN9
Anonymous
https://pastebin.com/6QWgA8CW
Anonymous
I Hope Both helps to solve @CJDP25
cj
you didn't run migrations
Anonymous
i have runeed them and models are being created
Anonymous
sorry for poor english
cj
i have runeed them and models are being created
it says you didn't relation "events_manager_studentmodel" does not exist
Anonymous
But it does i
Anonymous
I Just saw my data source and there is not table of studentmdel but when applying migrations StudentModel is created . Event the inital migrations showing it
cj
🤔 can I ask how did you "run" migrations?
Anonymous
Python manage.py makemigrations appname python manage.py migrate
Anonymous
Hey @CJDP25 i need to share an image can you give me the permission to share so it could be more clear
cj
Hey @CJDP25 i need to share an image can you give me the permission to share so it could be more clear
I'm not admin, but I don't see a rule that avoid you to post images 🤷🏻‍♂️
Anonymous
Its is saving until 4august