Rohan
Dude chill
Doragonsureiyā
hello, just want to know steps to change default django admin login template to my own customize html page ...??
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
Alex
Would you help me with this situation, how to transfer in function "validate_date" parameter "date"?
Validators simply accept a value of its field. So in your case it will be validate_date(datetime) and you will have to deal with this object in your function.
Damron
There must be something to ur data
can you please tell what do you mean?
Maz
Sigh. I miss the days when this group had < 900 members. No fighting over BS, cool convos. 😏
#
can you please tell what do you mean?
Bad request happen when ur data conflict to appropriate one, maybe it could be additional data or mismatch data type
Damron
Hmph But I just raising `ValidationError`and that is all
Alex
Hi everyone! We can validate data while creating model in two ways: 1) in ModelForm - using clean_fieldname 2) in Model itself (If there is some another useful method to validate data, pls, tell😅) So - what is the more widely used way to validate data?
It is a wide topic. In short words - you should use Form.clean for a particular case and Model.clean for general. For example, you have a model Order and after a user submmited it, it will be processed by different groups of operators (to confirm, to find consisting items and so on) but you always want that model to check some of its fields.
Alex
I probably need to use the clean () method?
Considering the code you provided - no.
Alex
SELECT name, STRING_AGG(description, ', ') FROM test JOIN ekwdesc ON ekwdesc.value = ANY(test.ekw) GROUP BY name Hi, How can I write a query like this using ORM?
Not sure about that ANY, but I think that that STRING_AGG will be smt like: from django.db.models import F, Func Test.objects.annotate(description_agged=Func(F('description'), function='STRING_AGG'))
Shubham
Can anyone help me with django. I am having errors
Shubham
I just need 2 mins of ur time
Doragonsureiyā
Can anyone help me with django. I am having errors
Please don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello I need help on $z" Just ask about your problem directly! With 52k+ people the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Shubham
!meta
I cannot explain error. It is like a small problem but i am unable to understand as i m a beginner
Shubham
I can send photos to explain
Alex
describe your problem here
Shubham
Lol. Then what should I do?
Shubham
What does it means by TypeError: 'module' object not iterable
Alex
What does it means by TypeError: 'module' object not iterable
I think it is self-explaining - you cannot iterate an instance of module.
Shubham
Meaning? Instance?
Alex
ahhhh, just provide the full traceback
.
Not sure about that ANY, but I think that that STRING_AGG will be smt like: from django.db.models import F, Func Test.objects.annotate(description_agged=Func(F('description'), function='STRING_AGG'))
Thankyou for the response...My problem is similar to this question: https://stackoverflow.com/questions/30816763/postgresql-integer-array-value-join-to-integer-in-other-table-with-desc-string . The solution query given in this question works correctly. But I want to write that same query using Django ORM. Is that possible using orm?
Shubham
PS C:\Users\dell\Desktop\mysite\mysite> python manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 589, in url_patterns iter(patterns) TypeError: 'module' object is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run self._target(*self._args, self._kwargs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper fn(*args, kwargs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 392, in check all_issues = self._run_checks( File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 407, in check messages.extend(check_resolver(pattern)) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 406, in check for pattern in self.url_patterns: File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in get res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 596, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'blog.urls' from 'C:\\Users\\dell\\Desktop\\mysite\\mysite\\blog\\urls.py'>' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
.
I'm not orm-guru. And I'm agreed that if smt hard to make in it - simply use raw sql
Yes...But using raw sql i will lost other features of orm, like filter.
Shubham
ahhhh, just provide the full traceback
This is the complete error I am getting. I was following a tutorial to make blog application using django
Rohan
PS C:\Users\dell\Desktop\mysite\mysite> python manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 589, in url_patterns iter(patterns) TypeError: 'module' object is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run self._target(*self._args, self._kwargs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper fn(*args, kwargs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 392, in check all_issues = self._run_checks( File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 407, in check messages.extend(check_resolver(pattern)) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 406, in check for pattern in self.url_patterns: File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in get res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 596, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'blog.urls' from 'C:\\Users\\dell\\Desktop\\mysite\\mysite\\blog\\urls.py'>' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
Heard of pastebin?
Shubham
Heard of pastebin?
No. What is it?
Rohan
No. What is it?
🤦‍♂ pastebin.com
Alex
No. What is it?
It is where you should post that. Not in the chat.
Shubham
Ohh Ok
Rohan
Paste your stuff there and give us a link instead
Rohan
Also do you have this project on git?
Rohan
Cuz it'll be tough to debug with half ass resource like your traceback
Shubham
Ok
Shubham
Also I am following a tutorial. Link: https://djangocentral.com/building-a-blog-application-with-django/
Shubham
All codes are here.
Shubham
Dude, you're doing something wrong probably
Ya I know m doing something wrong. But unable to find my mistake. I followed tutorial line by line
Rohan
your main urls and <app>.urls
Rohan
Something you messed up there
Rohan
Ya I know m doing something wrong. But unable to find my mistake. I followed tutorial line by line
Make your project a git repo, 1. You get to learn vcs which is kinda important 2. You reap benefits of vcs. 3. Easy to ask what's wrong 4. It's a win win, so profit?
Anonymous
Yeah paste both and I'll have a better idea!
Anonymous
Both urls.py I mean.
Shubham
Blog url.py: pastebin.com/mVVzDH3Y
Shubham
main url: pastebin.com/xELfvveJ
Shubham
Rohan
Without gitops, you're crippling yourself with mediocrity.
Rohan
"imho"
Shubham
Time to learn
😂 since many days, I am learning only. I still barely understand keywords used in this group
Shubham
Time to learn
Any suggested place? What exactly is this vsc git etc?
Rohan
You're using windows, right? Can you open a command prompt shell in your project directory and run a tree command?
Rohan
Post your result on pastebin as usual
Alex
😂 since many days, I am learning only. I still barely understand keywords used in this group
Be like a postage stamp — stick to one thing until you get there. (J. Billings)
Alex
Posted both
It appears to me that there is nothing "criminal" in these files. It means that the error in some another module.
Rohan
I'm sorry, tree doesn't list the files under a directory?
Shubham
I guess
Rohan
dir
Is that a flag you need to add or a command altogether?
Rohan
Sorry, I have 0 experience with window$
PV
Command to list directories under a folder (alternative for ls command in Linux)
Alex
Any suggested place? What exactly is this vsc git etc?
Register on github.com. Create a repo and push there the project. We need to see it whole
Shubham
Visual studio code is showing an error in views.py under blog which is this. . pastebin.com/JQmA1MG9
Shubham
In line 5, error: Class Post has no objects