Skip to content

Commit

Permalink
For #26 add via main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lissa3 committed Nov 8, 2023
2 parents 086fb21 + 3d7dbf6 commit 4a11ff1
Show file tree
Hide file tree
Showing 29 changed files with 114 additions and 142 deletions.
2 changes: 1 addition & 1 deletion sandbox/conf/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"PORT": "5432",
}
}

# use in-memory-db
# let op: email confirmation will be NOT in console
# EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"


USE_CAPCHA = False
1 change: 0 additions & 1 deletion src/comments/tests/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def test_error_submit_no_body_root_commet(self):
div_comms = resp_submit.html.find("div", class_="comms")

msg_txt = _("This field is required.")
print(resp_submit.context["form"].errors)

self.assertEqual(self.resp.status_code, 200)
self.assertEqual(resp_submit.status_code, 200)
Expand Down
1 change: 1 addition & 0 deletions src/contacts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class NewsLetterAdmin(admin.ModelAdmin):
related posts status should be changd
"""

list_display_links = ["title"]
date_hierarchy = "added_at"
search_fields = ("title", "letter_status")

Expand Down
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions src/contacts/management/commands/send_news_letter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ def handle(self, *args, **options):
raise NewsFansNotFoundException("No profiles not send news")
elif not letter:
raise LetterNotFoundException("No letter to send")

self.stdout.write(self.style.SUCCESS("Successfully sent newletter"))
2 changes: 0 additions & 2 deletions src/core/utils/tree_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def get_cached_trees(queryset) -> list:
for obj in queryset:
obj._cached_children = []
if obj.depth == queryset[0].depth:
# print("line 45 obj depth == qs[0]")
# print("adding to top node")
add_top_node(obj, top_nodes, path)
else:
while not is_child_of(obj, parent := path[-1]):
Expand Down
2 changes: 0 additions & 2 deletions src/devs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def get_queryset(self):
def get_context_data(self, **kwargs):
"""author can see in admin their permitted objects"""
ctx = super().get_context_data(**kwargs)
print("header is ", self.header)

ctx["header"] = self.header
# if self.request.user.has_perm("posts.add_post"):
Expand Down Expand Up @@ -112,7 +111,6 @@ class ChangeState(SURM, View):
def post(self, request, **kwargs):
uuid = request.POST.get("uuid", None)
current_state = request.POST.get("current_state")
print("current status", current_state)
post = get_object_or_404(
Post, uuid=uuid, status=current_state, author=self.request.user
)
Expand Down
2 changes: 1 addition & 1 deletion src/notifications/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_failure_notific_as_read(self):
url = reverse(
"notifications:mark_top_read",
)
print("I am here")

with self.assertRaises(HtmxFailureError) as e:
resp = self.client.post(url) # noqa

Expand Down
3 changes: 1 addition & 2 deletions src/posts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PostAdmin(TranslationAdmin):
search_fields = ("title", "categ__name")
list_display = [
"id",
# "author",
"send_status",
"title",
"status",
"is_deleted",
Expand All @@ -48,7 +48,6 @@ class PostAdmin(TranslationAdmin):
"count_bmarks",
]
list_select_related = ("categ", "author")
list_editable = ["is_deleted"] # , "status"]
list_display_links = ["title"]
radio_fields = {"status": admin.HORIZONTAL}
save_on_top = True
Expand Down
2 changes: 0 additions & 2 deletions src/posts/templatetags/calend.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
def show_archive(**kwargs):
"""substitute template sidebar `calender` with dropdown archive"""
arch = Post.objects.get_public().datetimes("published_at", "month", order="DESC")
# print("arch is", arch.count()) # amount months with posts
archives = {}
for item in arch:
year = item.year
month = item.month
print("month ", month)
for i in range(1, 13):
if i == month:
try:
Expand Down
3 changes: 1 addition & 2 deletions src/posts/views/post_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PostList(PostListMenuMixin, ListView):

template_name = "posts/post_list.html"
context_object_name = "posts"
paginate_by = 4
paginate_by = 6

def get_queryset(self):
return (
Expand Down Expand Up @@ -93,7 +93,6 @@ def post(self, request, *args, **kwargs):
Comment.add_root(instance=comm)
return self.form_valid(form)
else:
print("form invalid")
return self.form_invalid(form)

def get_success_url(self):
Expand Down
1 change: 0 additions & 1 deletion src/profiles/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def clean(self, *args, **kwargs):
params={"size": filesizeformat(min_upload_size)},
)
if up_file.size > max_upload_size:
# print("too big ...")
raise ValidationError(
err_msg["max_size"],
params={"size": filesizeformat(max_upload_size)},
Expand Down
2 changes: 2 additions & 0 deletions src/profiles/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import uuid

from boto3.session import Session
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
from django.shortcuts import reverse
Expand Down
1 change: 1 addition & 0 deletions src/static/css/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
}
.not-found{
background-color: #b1c3b28a;
border-radius: 10px;
}

/* end categs search */
Expand Down
127 changes: 57 additions & 70 deletions src/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ body padding-top: 165px;
html,body{
margin:0;
padding: 0;
background-color:#f1dfc5;
background-color:#f0e1cd;
font-family:"Poppins",sans-serif;
height: 100%;
}
Expand Down Expand Up @@ -54,6 +54,8 @@ scroll to top button
}
.wraps {
min-height: 100%;
/* max-width:100%; */
overflow: hidden;
display:flex;
flex-direction: column;
}
Expand All @@ -67,7 +69,7 @@ footer{
.red{
color: red;
}

/* for likes .redish */
.redish{
color: rgb(234, 164, 164);
}
Expand All @@ -77,24 +79,14 @@ footer{
padding:0.5rem;
border-radius: 5px;
}
.note{
background-color: #7db099;
color:white;
padding:5px 10px;
border-radius: 5px;

}
.or{
background-color: #f0551d;
}
/* .green in flash msg */
.green{
background-color:#1987547d;
padding:10px;
border-radius: 10px;
}
.blue{
background-color: #296684;
}
/* for admin? */
.wide{
width: 100%;
}
Expand All @@ -105,16 +97,63 @@ footer{
margin:20px 0;
border-radius: 5px;
}

/* override bootstrap 5 */
.breadcrumb-item {
color:#7e736f;
font-size: 1.5rem;
}
/* breadcrum a tag */
.breadcrumb-item a{
color:#0f3649
color:#0f3649;
text-decoration: none;

}
/* test with grid layout */
.wrap{
display:grid;
grid-gap:1.5rem;
grid-template-columns:1fr;
/* grid-template-rows: 300px 600px 300px 300px; */
}
.grid-tags{
grid-row:4/5;
}
.grid-categs{
grid-row:1/2;
}
.grid-content{
grid-row:3/4;
padding-left:1rem;
}
.grid-archive{
grid-row:2/3;
}

@media (min-width:700px){
.wrap{
display:grid;
grid-gap:1rem;
grid-template-columns: 18% 60% 22% ;
/* padding-block:2rem; */
width:100%;
/* margin-inline: auto; */
}
.grid-categs{
grid-row:1/3;
}
.grid-content{
grid-row:1/3;
padding-left:1rem;
}
.grid-archive{
grid-row:1/2;
}
.grid-tags{
grid-row:2/3;
}
}
/* end test with grid layout */


/* override bootstrap 5 */
.btn-secondary {
background-color: rgb(165, 46, 6);
Expand Down Expand Up @@ -156,7 +195,7 @@ footer{
background-color:#302725;
border-color:#302725;
color:white;
/* color:rgb(212, 205, 177); */

}
.btn-warning {
background-color:#c34b14cf;
Expand Down Expand Up @@ -456,58 +495,6 @@ a.reply:visited {
--color-10: "#36654f",
}

.color-8{
fill:coral;
}
.color-2{
fill: darkmagenta;
}
.color-3{
fill: firebrick;
}
.color-4{
fill: sienna;
}
.color-5{
fill: silver;
}
.color-6{
fill: forestgreen;
}
.color-7{
fill: teal;

}
.color-1{
fill: rgb(220, 81, 56);
}
.color-9{
fill: goldenrod;
}
.color-10{
fill: orangered;
}
.avat {
width: 48px;
height: 48px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.letter{
fill:white;

}

/* search result highlight */
/* todo ... */
.search-result{
color: #f0551d;
font-weight: 900;
}


/* *******************
Pagination
******************* */
Expand Down
20 changes: 0 additions & 20 deletions src/static/css/temp_test.css

This file was deleted.

3 changes: 0 additions & 3 deletions src/static/js/bookmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
.then((data)=>{
if(data.status_code ===200){
let msg = data.msg;
console.log("msg from the server ",msg)
jsBox.classList.add("green","slide");
jsBox.textContent= msg;
if(data.del_button){
console.log("removing bmark button from the DOM");
bmarkDiv.remove();
console.log("div removed");
}
}
else if(data.status_code ===404){
Expand Down
3 changes: 0 additions & 3 deletions src/static/js/checkState.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const checkInp = (checkbox,inp)=>{
2.toggle class 'disabled' on submit button
*/
if(checkbox){
console.log("checkbox in DOM; line 9")
// checkbox(remove avatar) present in DOM:
// checked vs unchecked
checkbox.addEventListener("change",(e)=>{
Expand Down Expand Up @@ -37,7 +36,6 @@ const checkInp = (checkbox,inp)=>{
// or "attach img" but not both
if(checkbox!=null){
// remove existed avatar (clear image input if user attached img occasionally);
console.log("checkbox NOT null; line 40")
checkbox.addEventListener("change",(e)=>{
if(checkbox.checked){
inp.value = null
Expand All @@ -55,7 +53,6 @@ const checkInp = (checkbox,inp)=>{
}
})
}else{
console.log("initial default state;line 58")
// checkbox NOT in DOM (avatar == default static image)
inp.addEventListener("change",()=>{
// toggle class 'disabled' on submit button
Expand Down
Loading

0 comments on commit 4a11ff1

Please sign in to comment.