Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logo url #158

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backend/donations/models/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class Ngo(models.Model):
upload_to=partial(ngo_directory_path, "logos"),
)

# originally: image_url
image_url = models.URLField(verbose_name=_("image url"), blank=True, null=False, default="")
image = models.ImageField(
verbose_name=_("image"),
Expand Down
2 changes: 1 addition & 1 deletion backend/donations/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get(self, request, *args, **kwargs):
{
"name": ngo.name,
"url": reverse("twopercent", kwargs={"ngo_url": ngo.slug}),
"logo": ngo.logo if ngo.logo else settings.DEFAULT_NGO_LOGO,
"logo": ngo.logo.url if ngo.logo else settings.DEFAULT_NGO_LOGO,
"active_region": ngo.active_region,
"description": ngo.description,
}
Expand Down
4 changes: 0 additions & 4 deletions backend/donations/views/my_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ def post(self, request, *args, **kwargs):

ngo.other_emails = ""

# TODO: implement the image upload
ngo.logo_url = post.get("ong-logo-url", "")
ngo.image_url = post.get("ong-logo")

ngo.save()

if is_new_ngo:
Expand Down
4 changes: 0 additions & 4 deletions backend/donations/views/ngo.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ def get(self, request, *args, **kwargs):
request.session.pop("has_cnp")
# also we can use request.session.clear(), but it might delete the logged-in user's session

# make sure the ngo shows a logo
ngo.logo_url = ngo.logo_url if ngo.logo_url else settings.DEFAULT_NGO_LOGO
context = {
"title": ngo.name,
"ngo": ngo,
Expand Down Expand Up @@ -390,8 +388,6 @@ def return_error(self, request, ngo, errors, is_ajax):
if is_ajax:
return JsonResponse(errors)

# make sure the ngo shows a logo
ngo.logo = ngo.logo if ngo.logo else settings.DEFAULT_NGO_LOGO
context = {
"title": ngo.name,
"ngo": ngo,
Expand Down
Loading