All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Add properties_ru JSON field to store translated category, crystal_system, luster, streak, specific_gravity, color_description - Add translate_minerals management command using deep-translator (Google Translate), with a hard-coded dictionary for crystal systems - Template: show translated values in RU mode, fall back to English if missing - Add deep-translator to requirements.txt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
1.4 KiB
Python
34 lines
1.4 KiB
Python
from django.db import models
|
|
|
|
|
|
class Mineral(models.Model):
|
|
name = models.CharField(max_length=200, unique=True)
|
|
formula = models.CharField(max_length=200, blank=True)
|
|
category = models.CharField(max_length=200, blank=True)
|
|
crystal_system = models.CharField(max_length=200, blank=True)
|
|
mohs_hardness = models.CharField(max_length=50, blank=True)
|
|
luster = models.CharField(max_length=200, blank=True)
|
|
streak = models.CharField(max_length=200, blank=True)
|
|
specific_gravity = models.CharField(max_length=100, blank=True)
|
|
color_description = models.CharField(max_length=300, blank=True)
|
|
color_hex = models.CharField(max_length=7, default='#6b7280')
|
|
description = models.TextField(blank=True)
|
|
history = models.TextField(blank=True)
|
|
image_urls = models.JSONField(default=list)
|
|
wikipedia_url = models.URLField(max_length=500, blank=True)
|
|
day_of_year = models.IntegerField(unique=True, null=True, blank=True)
|
|
|
|
# Russian translations
|
|
properties_ru = models.JSONField(default=dict, blank=True)
|
|
name_ru = models.CharField(max_length=200, blank=True)
|
|
description_ru = models.TextField(blank=True)
|
|
history_ru = models.TextField(blank=True)
|
|
color_description_ru = models.CharField(max_length=300, blank=True)
|
|
wikipedia_url_ru = models.URLField(max_length=500, blank=True)
|
|
|
|
class Meta:
|
|
ordering = ['day_of_year']
|
|
|
|
def __str__(self):
|
|
return self.name
|