• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gcivil-nyu-org / team1-wed-fall25 / 49

25 Oct 2025 06:30PM UTC coverage: 95.904% (-0.8%) from 96.727%
49

Pull #82

travis-pro

web-flow
Merge 8e124a5fb into 84b2ca6aa
Pull Request #82: Add images for public art

19 of 22 new or added lines in 3 files covered. (86.36%)

281 of 293 relevant lines covered (95.9%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.96
/loc_detail/models.py
1
from django.db import models
1✔
2
from django.contrib.auth.models import User
1✔
3
from django.utils.html import mark_safe
1✔
4

5

6
class PublicArt(models.Model):
1✔
7
    """Model for NYC Public Design Commission Outdoor Public Art"""
8

9
    # Basic Information
10
    artist_name = models.CharField(max_length=500, blank=True, null=True)
1✔
11
    title = models.CharField(max_length=500, blank=True, null=True)
1✔
12
    description = models.TextField(blank=True, null=True)
1✔
13
    image = models.ImageField(upload_to="", blank=True, null=True)
1✔
14

15
    def art_image(self):
1✔
NEW
16
        return mark_safe(
×
17
            '<img style="border: 1px solid #333; object-fit: contain;" src="{url}" width="500px" height="500px" />'.format(  # noqa E501
18
                url=self.image.url,
19
            )
20
        )
21

22
    # Location Information
23
    location = models.CharField(max_length=500, blank=True, null=True)
1✔
24
    borough = models.CharField(max_length=100, blank=True, null=True)
1✔
25
    latitude = models.DecimalField(
1✔
26
        max_digits=10, decimal_places=7, blank=True, null=True
27
    )
28
    longitude = models.DecimalField(
1✔
29
        max_digits=10, decimal_places=7, blank=True, null=True
30
    )
31

32
    # Art Details
33
    medium = models.CharField(max_length=300, blank=True, null=True)
1✔
34
    dimensions = models.CharField(max_length=300, blank=True, null=True)
1✔
35
    year_created = models.CharField(max_length=50, blank=True, null=True)
1✔
36
    year_dedicated = models.CharField(max_length=50, blank=True, null=True)
1✔
37

38
    # Administrative
39
    agency = models.CharField(max_length=200, blank=True, null=True)
1✔
40
    community_board = models.CharField(max_length=100, blank=True, null=True)
1✔
41

42
    # Original data reference
43
    external_id = models.CharField(max_length=100, unique=True, blank=True, null=True)
1✔
44

45
    # Timestamps
46
    created_at = models.DateTimeField(auto_now_add=True)
1✔
47
    updated_at = models.DateTimeField(auto_now=True)
1✔
48

49
    class Meta:
1✔
50
        verbose_name = "Public Art"
1✔
51
        verbose_name_plural = "Public Art Pieces"
1✔
52
        ordering = ["title"]
1✔
53

54
    def __str__(self):
1✔
55
        return f"{self.title or 'Untitled'} by {self.artist_name or 'Unknown'}"
1✔
56

57

58
class UserFavoriteArt(models.Model):
1✔
59
    """Track user's favorite art pieces"""
60

61
    user = models.ForeignKey(
1✔
62
        User, on_delete=models.CASCADE, related_name="favorite_art"
63
    )
64
    art = models.ForeignKey(
1✔
65
        PublicArt, on_delete=models.CASCADE, related_name="favorited_by"
66
    )
67
    added_at = models.DateTimeField(auto_now_add=True)
1✔
68
    notes = models.TextField(blank=True, null=True)
1✔
69

70
    class Meta:
1✔
71
        unique_together = ["user", "art"]
1✔
72
        ordering = ["-added_at"]
1✔
73

74
    def __str__(self):
1✔
75
        return f"{self.user.username} - {self.art.title}"
1✔
76

77

78
class ArtComment(models.Model):
1✔
79
    """User comments on art pieces"""
80

81
    user = models.ForeignKey(
1✔
82
        User, on_delete=models.CASCADE, related_name="art_comments"
83
    )
84
    art = models.ForeignKey(
1✔
85
        PublicArt, on_delete=models.CASCADE, related_name="comments"
86
    )
87
    comment = models.TextField()
1✔
88
    created_at = models.DateTimeField(auto_now_add=True)
1✔
89
    updated_at = models.DateTimeField(auto_now=True)
1✔
90

91
    class Meta:
1✔
92
        ordering = ["-created_at"]
1✔
93

94
    def __str__(self):
1✔
95
        return f"{self.user.username} on {self.art.title}"
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc