投稿時間:2022-11-21 19:34:54 RSSフィード2022-11-21 19:00 分まとめ(38件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia News] 「gmail.com」を「gmai.com」と誤記、10カ月気付かず2000件超の情報漏えいか 埼玉大が「ドッペルゲンガー・ドメイン」の毒牙に https://www.itmedia.co.jp/news/articles/2211/21/news144.html gmaicom 2022-11-21 18:37:00
AWS AWS Japan Blog Next.js 13 アプリケーションを Amplify Hosting でデプロイする https://aws.amazon.com/jp/blogs/news/amplify-next-js-13/ apptoawswithamplifyhosti 2022-11-21 09:40:28
AWS AWS Japan Blog AWS re:Invent 2022 AI/ML ガイド https://aws.amazon.com/jp/blogs/news/your-guide-to-ai-ml-at-aws-reinvent-2022/ awsreinventaiml 2022-11-21 09:07:12
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Rails】accepts_nested_attributes_forを使って子モデルも保存 https://qiita.com/a2c6201/items/0ef6f4fb241ce01bce86 acceptsnestedattr 2022-11-21 18:19:34
AWS AWSタグが付けられた新着投稿 - Qiita AWS CLI で SSO ログインを使用する方法 https://qiita.com/gorooe/items/5e20e261693417f723b3 awscli 2022-11-21 18:33:24
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails】accepts_nested_attributes_forを使って子モデルも保存 https://qiita.com/a2c6201/items/0ef6f4fb241ce01bce86 acceptsnestedattr 2022-11-21 18:19:34
技術ブログ Mercari Engineering Blog メルカリShops APIの紹介 https://engineering.mercari.com/blog/entry/20221121-mercari-shops-api/ hellip 2022-11-21 11:00:10
技術ブログ Developers.IO 開封率が1番高いチャネルを狙い撃ちするインテリジェントチャネルを紹介!#Braze https://dev.classmethod.jp/articles/braze_intelligence-intelligent_channel/ braze 2022-11-21 09:01:13
海外TECH DEV Community DJANGO HTMX LOAD MORE OBJECTS https://dev.to/arthurobo/django-htmx-load-more-objects-3jg3 DJANGO HTMX LOAD MORE OBJECTSIn this guide we ll be using Django and HTMX to load more objects from the database without refreshing our page Traditionally adding a load more button which sends a request to the database to load more data is done with JavaScript But now we can load more data by writing little to no JavaScript for this purpose First we need to set up our Django project by first creating a virtual environment and installing the necessary dependencies CREATING A VIRTUAL ENVIRONMENTTo create a virtual environment on your windows machine run the command below python m venv my projectNext we need to change the directory into the newly created virtual environment with the command below cd my projectNow we need to activate the virtual environment with the command below scripts activateWe are done with creating our virtual environment and can now continue to start our new project by first creating the project with the name blog But before we do that we need to first install Django which will be used and also going to help us create a Django project easily pip install DjangoAfter installing Django we now need to start our new Django blog project with the command below django admin startproject blogAfter starting our project we now need to change the directory into this newly created blog project with the command below cd blogWe re all set and can now test our project is ready by running the server To run the server use the command below python manage py runserverNow our server is running we can now go to our local host on port to confirm Django is running Congratulations we re now up and running and have successfully started our new Django project in a virtual environment which is now running on port Now we need to create a new app to handle all our blog posts To do this go back to your command line and kill the server running and then run this command below python manage py startapp postsNow our new posts app is ready we can now add the app in our settings py file To add it locate the INSTALLED APPS and add posts to the list INSTALLED APPS posts Now we can continue by creating our models instance in our posts app Go to models py in the posts app and continue with the code below class Post models Model title models CharField max length description models CharField max length body models TextField date created models DateTimeField auto now add True last updated models DateTimeField auto now True def str self return str self title After adding all to the models py we need to update our admin py file in the posts app so we can easily add posts from the easy django admin site from django contrib import adminfrom models import Postadmin site register Post We are good to go this is all we need for this tutorial Now we can proceed to migrate all our data to the database by running the command below python manage py makemigrationspython manage py migrateAfter migrating our database we now need to create a django superuser which will manage everything in our django admin panel which includes adding posts to our database Run the command below to create a superuser python manage py createsuperuserFill in your credentials and then your superuser can now log into the admin panel which is located at admin First you need to run the server again to access the django admin panel Login to the django admin panel and add at least blog posts for our testing purpose We now have up to blog posts so we can start doing all we have to do in loading our posts on our site First we need to go to the posts app and start writing our home view to load all our posts from django shortcuts import renderfrom models import Postdef home request posts Post objects all context posts posts return render request posts all posts html context Breakdown of our views pyfirst line imports render which returns a HttpResponseThe second line imports our Post models objects which return all the posts we added to the database initially Our function is the views that our URLs will call and render This function also adds our blog posts to the context which can be called in the Django template languageThis is all we need in our views for now we can now proceed to add our URLs so Django will display our posts in the root URL To do this create a url py file in the posts app and add the code below from django urls import pathfrom views import homeapp name home urlpatterns path home name home Now we need to add this URL in the root URLs We now need to go to blog urls py and update it to be like this code below from django contrib import adminfrom django urls import path includeurlpatterns path admin admin site urls path include posts urls namespace posts Now we can run the server and visit Now you ll see we have an error which says TemplateDoesNotExist at posts all posts htmlThis is a friendly error for us in this case and it shows we have all things in place Next we ll need to create a templates folder in our root directory and a posts folder in the newly created templates folder In this posts folder we need to add our home html file This setup is based on our views py where we have our home html setup Once this is in place we need to go to our settings py file and instruct Django where to find our Html files TEMPLATES BACKEND django template backends django DjangoTemplates DIRS BASE DIR templates APP DIRS True Here we updated the DIRS with the value DIRS BASE DIR templates This is all we need for our templates setup we ll add our html files soon Next we need to install htmx with the command below pip install django htmxAfter installing htmx we now need to add htmx to our installed apps django htmx Next is to add htmx to our middleware django htmx middleware HtmxMiddleware We re all ready to start using htmx in our django project First we have to go to views py and update our views with the code below from django shortcuts import renderfrom models import Postfrom django core paginator import EmptyPage PageNotAnInteger Paginatordef home request posts load posts request context posts posts return render request posts all posts html context def list load posts view request posts load posts request context posts posts return render request posts partials all posts html context def load posts request page request GET get page posts Post objects all order by date created paginator Paginator posts try posts paginator page page except PageNotAnInteger posts paginator page except EmptyPage posts paginator page paginator num pages return postsWe re all good to go our last steps will include creating a urls py file in our posts app and update with the code belowfrom django urls import pathfrom views import home list load posts viewapp name home urlpatterns path home name home path posts list load posts view name posts Now we have all our setup we can now add our html files We need two html files one is the main home page view while the second will be included from our htmx view from our partials folder Now if we go back to our root url we ll see a django error html page This shows we re on the right track and can now update our all posts html file with the code below lt doctype html gt lt html lang en gt lt head gt lt Required meta tags gt lt meta charset utf gt lt meta name viewport content width device width initial scale gt lt Bootstrap CSS gt lt link href dist css bootstrap min css rel stylesheet integrity sha EVSTQN azprGAnmQDgpJLImNaoYzztcQTwFspdyDVohhpuuCOmLASjC crossorigin anonymous gt lt title gt Hello world lt title gt lt HTMX gt lt script src gt lt script gt lt script src latest Sortable min js gt lt script gt lt head gt lt body gt lt style gt centralize div display flex important justify content center important lt style gt lt nav class navbar navbar expand lg navbar light bg light gt lt div class container fluid gt lt a class navbar brand href gt BLOG lt a gt lt button class navbar toggler type button data bs toggle collapse data bs target navbarSupportedContent aria controls navbarSupportedContent aria expanded false aria label Toggle navigation gt lt span class navbar toggler icon gt lt span gt lt button gt lt div class collapse navbar collapse id navbarSupportedContent gt lt ul class navbar nav me auto mb mb lg gt lt li class nav item gt lt a class nav link active aria current page href gt Posts lt a gt lt li gt lt ul gt lt div gt lt div gt lt nav gt lt div class container py gt lt div class row gt include posts partials all posts html lt div gt lt div gt lt script src dist js bootstrap bundle min js integrity sha MrcWZMFYlzcLANl NtUVFsAMsXsPUyJoMpYLEuNSfAP JcXn tWtIaxVXM crossorigin anonymous gt lt script gt lt body gt lt html gt If we go through our code above you can see we have a basic bootstrap navigation bar and all our posts from the database Lastly we need to create a folder named partials in the posts templates and add the just included html file all posts html Add the code below to the htmx partials file if posts for post in posts lt div class col md centralize div gt lt div class card m p style width rem gt lt div class card body gt lt h class card title gt post title lt h gt lt p class card text gt post body truncatechars lt p gt lt lt a href class btn btn primary gt Visit lt a gt gt lt div gt lt div gt lt div gt endfor else lt div class centralize div gt lt h class ui header center aligned gt No results lt h gt lt div gt endif lt div class centralize div py id load more gt if posts has next lt div class ui divider gt lt div gt lt button class btn btn primary hx get url posts posts hx vals page posts next page number posts posts hx target load more hx swap outerHTML gt Load more lt button gt endif lt div gt Congratulations we now have a working django project which has the load more feature working fine with less code and working efficiently You can access the code in the github repo also feel free to ask your questions and possible suggestions if you find me making the wrong decisions I appreciate your time and effort 2022-11-21 09:11:42
海外TECH CodeProject Latest Articles Visualizing the architecture with the C4 model and PlantUML https://www.codeproject.com/Articles/5347563/Visualizing-the-architecture-with-the-C4-model-and visualization 2022-11-21 09:41:00
金融 RSS FILE - 日本証券業協会 外国投信の運用成績一覧表 https://www.jsda.or.jp/shiryoshitsu/toukei/foreign/index.html 運用 2022-11-21 10:30:00
金融 金融庁ホームページ 金融庁の災害用備蓄食品において提供可能となる食品に関する情報を公表しました。 https://www.fsa.go.jp/choutatu/choutatu_j/choutatsu_saigaisyokuhin.html 食品 2022-11-21 10:00:00
金融 ニッセイ基礎研究所 タイ経済:22年7-9月期の成長率は前年同期比4.5%増~観光業の回復が続き、約1年ぶりの高成長に https://www.nli-research.co.jp/topics_detail1/id=73026?site=nli タイ経済年月期の成長率は前年同期比増観光業の回復が続き、約年ぶりの高成長に年月期の実質GDP成長率は前年同期比増前期同増と上昇、Bloomberg調査の市場予想と一致する結果となった図表。 2022-11-21 18:46:32
海外ニュース Japan Times latest articles U.S. aims to expand plans for military presence in Philippines https://www.japantimes.co.jp/news/2022/11/21/asia-pacific/politics-diplomacy-asia-pacific/kamala-harris-visits-philippines/ U S aims to expand plans for military presence in PhilippinesThe faster implementation and potential expansion of a defense deal is one of the main initiatives being discussed by U S Vice President Kamala Harris 2022-11-21 18:02:44
海外ニュース Japan Times latest articles Samurai Blue has chance to win over hearts of Japanese fans again at World Cup https://www.japantimes.co.jp/sports/2022/11/21/soccer/international-soccer/samurai-blue-world-cup-identity/ global 2022-11-21 18:14:22
海外ニュース Japan Times latest articles Japan must brave challenging climb to reach lofty ambitions at World Cup https://www.japantimes.co.jp/sports/2022/11/21/soccer/international-soccer/world-cup-2022-japan-preview/ qatar 2022-11-21 18:13:47
ニュース BBC News - Home Fifa says wearing OneLove armband would break rules https://www.bbc.co.uk/sport/football/63699477?at_medium=RSS&at_campaign=KARANGA qatar 2022-11-21 09:55:15
ニュース BBC News - Home Indonesia: Java quake kills 14 and injures hundreds https://www.bbc.co.uk/news/world-asia-63700629?at_medium=RSS&at_campaign=KARANGA jakarta 2022-11-21 09:22:41
ニュース BBC News - Home Man forced at gunpoint to drive to NI police station https://www.bbc.co.uk/news/uk-northern-ireland-63696190?at_medium=RSS&at_campaign=KARANGA object 2022-11-21 09:55:46
ビジネス 不景気.com 山形・米沢の元旅館経営「SY」に特別清算決定、負債6億円 - 不景気com https://www.fukeiki.com/2022/11/kajikaso.html 山形県米沢市 2022-11-21 09:35:42
サブカルネタ ラーブロ カレーラーメン 味の大王 室蘭本店 塩篇 http://ra-blog.net/modules/rssc/single_feed.php?fid=204934 味の大王 2022-11-21 09:26:14
北海道 北海道新聞 <釧根まち物語>第9部 釧路駅北側かいわい2 異色スーパー 駄菓子から流行服まで https://www.hokkaido-np.co.jp/article/763665/ 高級 2022-11-21 18:26:00
北海道 北海道新聞 首相、閣僚更迭で再び陳謝 「任命責任、重く受け止める」 https://www.hokkaido-np.co.jp/article/763666/ 代表質問 2022-11-21 18:26:00
北海道 北海道新聞 保護者ら英語テストで都側を提訴 高校入試「公平性に問題」 https://www.hokkaido-np.co.jp/article/763664/ 高校入試 2022-11-21 18:26:00
北海道 北海道新聞 横田教授の「コロナ」チェック 月間の死亡者数が最多に 感染増減は新派生株の動向が鍵 https://www.hokkaido-np.co.jp/article/763601/ 新型コロナウイルス 2022-11-21 18:23:33
北海道 北海道新聞 日本ハム 楽天と開幕戦 パリーグ来季日程発表 https://www.hokkaido-np.co.jp/article/763642/ 日本ハム 2022-11-21 18:23:26
北海道 北海道新聞 JAようてい蘭越地区、ゆめぴりかコンテストV https://www.hokkaido-np.co.jp/article/763660/ 出来栄え 2022-11-21 18:21:00
北海道 北海道新聞 青森山田は広島皆実と対戦 高校サッカー組み合わせ https://www.hokkaido-np.co.jp/article/763662/ 全国高校サッカー選手権 2022-11-21 18:21:00
北海道 北海道新聞 生徒考案の和菓子 開校60周年に彩り 小樽・桜町中 「つくし牧田」協力 https://www.hokkaido-np.co.jp/article/763651/ 開校 2022-11-21 18:15:00
北海道 北海道新聞 電力「最終保障供給」、道内で契約増 新電力が更新・新規受け入れできず https://www.hokkaido-np.co.jp/article/763649/ 電力 2022-11-21 18:14:00
北海道 北海道新聞 グリコがポッキー再値上げ 338品目、来年2月出荷分から https://www.hokkaido-np.co.jp/article/763648/ 江崎グリコ 2022-11-21 18:12:00
北海道 北海道新聞 道運輸局、今冬からサイトで運休情報まとめて発信 https://www.hokkaido-np.co.jp/article/763647/ 北海道運輸局 2022-11-21 18:05:00
ニュース Newsweek ロシアが撒いた1500個の宇宙ゴミを受け、ISSが回避行動を迫られる https://www.newsweekjapan.jp/stories/world/2022/11/1500iss.php 昨年月にロシアが実施した衛星破壊実験ASATは、その後も断続的にISSにマヌーバーを迫っている。 2022-11-21 18:20:25
ニュース Newsweek W杯開催カタールの「北朝鮮コネクション」 https://www.newsweekjapan.jp/stories/world/2022/11/post-100165.php 中国とロシアが当初の賛同にもかかわらず、取り決めを無視していることが大きな原因だ。 2022-11-21 18:15:00
IT 週刊アスキー ROCCATより、Vulcan TKL新色ホワイトや新作ゲーミングマウス、ヘッドセットが発売 https://weekly.ascii.jp/elem/000/004/114/4114100/ roccat 2022-11-21 18:50:00
IT 週刊アスキー 道路に線や矢印を照射、大日本印刷が小型照明装置を試験販売へ https://weekly.ascii.jp/elem/000/004/114/4114106/ 大日本印刷 2022-11-21 18:40:00
IT 週刊アスキー 日立、約2ヵ月分のごみをためられる紙パック式コードレスクリーナー「かるパックスティック」 https://weekly.ascii.jp/elem/000/004/114/4114096/ pkvbkk 2022-11-21 18:30:00
IT 週刊アスキー ローソン銀行ATMでカードを使わずに入出金ができる「スマホATM」サービス開始 https://weekly.ascii.jp/elem/000/004/114/4114108/ 月日 2022-11-21 18:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)