question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I am working on an Arabic blog and whenever I insert the tags in Arabic it saves the tag’s slug as an empty string. is there a way to allow Unicode tags slugs?

Models

class Post(models.Model, HitCountMixin):
    title = models.CharField(max_length=255)
    slug = models.SlugField(unique=True, allow_unicode=True)
    summary = models.CharField(max_length=500)
    header_image = models.ImageField(null=True, blank=True, upload_to="images/")
    tags = TaggableManager()
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    body = RichTextField(blank=True, null=True)
    post_date = models.DateField(auto_now_add=True)
    update_date = models.DateField(auto_now=True)
    category = models.ForeignKey(Category, related_name='posts', on_delete=models.CASCADE)
    featured = models.BooleanField(default=False)
    views = GenericRelation(HitCount, object_id_field='object_pk',related_query_name='hit_count_generic_relation')

Forms

class AddPostForm(forms.ModelForm):
    class Meta:
        model = Post
        fields = ('title','summary', 'body', 'header_image', 'category', 'tags')

        labels = {
        "title": "العنوان",
        "tags": "العلامات",
        "category": "التصنيف",
        "summary":"الملخص",
        "body": "المحتوى",
        "header_image": "الغلاف",
        }

        widgets = {
            'title': forms.TextInput(attrs={'class':'form-control'}),
            'tags': forms.TextInput(attrs={'class':'form-control', 'data-role':"tagsinput", 'name':"tags"}),
            'category': forms.Select(choices=choices_list, attrs={'class':'form-control'}),
            'summary': forms.TextInput(attrs={'class':'form-control'}),
            'header_image': forms.FileInput(attrs={'class':'form-control'}),
            'body': forms.Textarea(attrs={'class':'form-control'}), 
        }

Views

class AddPostView(CreateView):
    model = Post
    form_class = AddPostForm
    template_name = 'add_post.html'

    def form_valid(self, form):
        form.instance.author = self.request.user
        return super().form_valid(form)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AnasBuhayhcommented, Sep 30, 2021

@AnasBuhayh It sounds strange to me. I have used Cyrillic for tags and have not seen any issues with taggit.

@sergeyklay I am really sorry but I found out that I didn’t mention that my issue was with the slugs! the tag is saved but the slug associated with that tag is saved as an empty string.

sorry again for the confusion

0reactions
rtpgcommented, May 2, 2022

This should be fixed in django-taggit 3.0.0!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unicode - Wikipedia
This article contains uncommon Unicode characters. Without proper rendering support, you may see question marks, boxes, or other symbols. Unicode's success at ...
Read more >
What is Unicode?
Support of Unicode forms the foundation for the representation of languages and symbols in all major operating systems, search engines, browsers ...
Read more >
Unicode Support - IBM
Unicode Support. The Unicode Standard is a standardized character code designed to encode international texts for display and storage. It uses a unique...
Read more >
Support for Unicode | Microsoft Learn
Unicode is a specification for supporting all character sets, including ones that can't be represented in a single byte.
Read more >
Unicode Support - AutoIt
AutoIt Notation, Notepad, Notepad++, SciTE (AutoIt Default Editor). UTF8 without BOM, ANSI or UTF-8 depending on content (will force a BOM if saved) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found