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
Anonymous
inchidi
N S
Which is the best library to import csv files to models
Mounikesh
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
Meera
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
is django 2.1 is unstable or under developmetn?
Mirco
It's been released today as stable
Mirco
2.2 is under dev
inchidi
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"),
]
inchidi
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
ππππ¬ππΎππππ
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')
Milan
cj
👍
inchidi
Rohan
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
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
Jimmies San
postgres is better :D
shiitakePLπ΅π±
postgres, rabbit, elasticsearch, mongo, redis....all depend what do U doing
Anonymous
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
👍
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
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
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
Anonymous
Its is saving until 4august