Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    You add a context processor that takes place in the bootstrap process. For instance I needed access to two forms in all my templates and views. Because I do login and signup as a modal in my base template.
    It allows you to do some really nice things without repeating yourself
    Example in settings.py.
    "BACKEND": "django.template.backends.django.DjangoTemplates",
    "DIRS": [os.path.join(PROJECT_ROOT, "templates")],
    "OPTIONS": {
    "debug": DEBUG,
    "context_processors": context_processors,
    "loaders": loaders,
    "string_if_invalid": '<< MISSING VARIABLE "%s" >>' if DEBUG else "",
    @jyoost I'll have a look. Thanks! :)
    I don't think it will work for my use-case as I don't use templates.
    MARIOREDFOX Any one please suggest me about django channels, how to learn it fast and crisp and deep...
    Sean Parsons
    Are there any good django applications for creating online courses?
    Such as sections, videos and tests?

    how can we add image in header of a pdf report?
    i am currently using reportlab to generate a pdf and am having issue adding company's logo in the pdf's header(as letterhead)

    any idea how this can be achieved?

    @jenishacharya_gitlab do you store the file in static?
    @novski yes, it is stored in the static directory.
    i am able to add the image in document 's body but not header
    Ajira Jenish (Gitter) do you have an exemple ?
    I am having IntegrityError with multiple databases
    Any here who has experience please share
    Jason Stokes
    Hey just created a new platform to help developers find jobs. Sign up for an account @ www.quirkycoders.com so that employers can find you.
    Hello there!
    I have an error in digital certificate with bit4id.
    I can't sent challenge response to smartengine server.
    Please help me!
    Hey, I've been looking into generic foreign keys, and I've been wondering if you can limit the field type choices for them

    For example if you have a model like this

    class Message(models.Model):
        message = models.CharField(max_length=100)
        source_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL,)
        source_id = models.PositiveIntegerField(null=True)
        source = GenericForeignKey('source_type', 'source_id', )

    How can you limit the foreign key to be for only two or three types of models ?

    I've thought of adding a validator to the type field but I have a feeling there's a better way
    Max Wittig
    Is this the right place to ask questions, if one seached the Internet for a couple of hours?
    Max Wittig
    if so. Anybody knows how to do
    SELECT id, name, something FROM something

    without using values and by using database operations, when the model is more complicated?


    class SomeComplicatedModel(models.Model):
        id = models.IntegerField(primary_key=True)
        name = models.CharField(max_length=2000)
        description = models.CharField(max_length=2000, null=True, blank=True)
        members = models.ManyToManyField("GitlabUser")
        url = models.URLField(null=True, blank=True)
        namespace = models.CharField(max_length=2000)
        kind = models.CharField(choices=KIND_CHOICES, max_length=20)
        update_uuid = models.UUIDField()
        def __str__(self):
            return f"{self.id} | {self.namespace}"

    How do I access only kind from using values?

    This is complicated as values is only accepting positional arguments. So I might be able to access id and name using
    SomeComplicatedModel.objects.all().values("id", "name")

    but if I don't need name, things get complicated

    Thanks for any help! Hope this is the right channel

    i need help with some project which i was unable to run as it shows Using the URLconf defined in djangosite.urls, Django tried these URL patterns, in this order: --> The current URL, , didn't match any of these.
    can someone help me
    Ajira Hi sundeep, what is the url you tried to reach and what are the patterns in your djangosite/urls.py file ?
    defiance There is (or used to be) a legit reason to start your urlpatterns with an empty string; I can't remember what that is or if it's still relevant; anyone?
    hello, there.
    I have some error with digital signing with bit4id.
    That works on my local, but not on server
    if you have some experience with bit4id, please help me.
    Please send me your screenshots.
    thanks just a moment...
    as you know, this is bit4id client.
    but it is closed if I send request with server.
    Hey, I'm looking for a bit of guidance, project looking to implement a custom backend database engine provided over HTTP any advice or guides or example i can use to get me started?
    hello everybody
    I have an error in django migration
    error message is "relation 'srv_user' already exits
    please help me